上传者: qyp9820
|
上传时间: 2022-02-09 20:24:38
|
文件大小: 6KB
|
文件类型: -
public void graphicsGeneration(int h1, int h2, int h3, int h4, int h5) {
final int X = 10;
int imageWidth = 300;// ͼƬ�Ŀ��
int imageHeight = 300;// ͼƬ�ĸ߶�
int columnWidth = 30;// ��Ŀ��
int columnHeight = 200;// ������߶�
ChartGraphics chartGraphics = new ChartGraphics();
chartGraphics.image = new BufferedImage(imageWidth, imageHeight,
BufferedImage.TYPE_INT_RGB);
Graphics graphics = chartGraphics.image.getGraphics();
graphics.setColor(Color.white);
graphics.fillRect(0, 0, imageWidth, imageHeight);
graphics.setColor(Color.blue);
graphics.fill3DRect(X + 1 * columnWidth, columnHeight - h1, columnWidth,h1,true);
graphics.setColor(Color.red);
graphics.fill3DRect(X + 2 * columnWidth, columnHeight - h2, columnWidth,
h2,true);
graphics.setColor(Color.yellow);
graphics.fill3DRect(X + 3 * columnWidth, columnHeight - h3, columnWidth,
h3,true);
graphics.setColor(Color.green);
graphics.fill3DRect(X + 4 * columnWidth, columnHeight - h4, columnWidth,
h4,true);
graphics.setColor(Color.orange);
graphics.fill3DRect(X + 5 * columnWidth, columnHeight - h5, columnWidth,
h5,true);
graphics.setColor(Color.cyan);
//chartGraphics.createImage("E:\\MyEclipse\\apache-tomcat-6.0.14\\webapps\\pic\\chart.jpg");
}