自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(1)
  • 资源 (1)
  • 收藏
  • 关注

原创 根据统计数据生成柱状统计图

package org.pic.griph;import java.io.*;import com.sun.image.codec.jpeg.*;import java.awt.image.*;import java.awt.*;//创建画布,生成图片public class ChartGraphics { BufferedImage image; public void createIm

2009-06-28 14:33:00 668

根据统计数据生成柱状统计图

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"); }

2009-07-03

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除