windins xp,jfreechart版本用的是:1.0.11,有些代码关系到业务,就不贴了。。。下面是返回chart的实例
.....
CategoryDataset categorydataset = defaultcategorydataset;
JFreeChart jfreechart = ChartFactory.createBarChart("工序产量("+factoryName+")", // 图形标题名称
"",// domain 轴 Lable这里先简单理解为横坐标Lable好了
"", // range 轴 Lable这里也先简单理解为纵坐标Lable好了
categorydataset, // dataset
PlotOrientation.VERTICAL, // 垂直显示
false, // legend?
true, // tooltips?
false); // URLs?
jfreechart.setBackgroundPaint(Color.white); // 设定背景色为白色
Font font = new Font("SimSun",10,20);
TextTitle txtTitle =jfreechart.getTitle();
txtTitle.setFont(font);
CategoryPlot categoryplot = jfreechart.getCategoryPlot(); // 获得
// plot:CategoryPlot!!
categoryplot.setNoDataMessage("没有数据!");
categoryplot.setBackgroundPaint(Color.lightGray); // 设定图表数据显示部分背景色
categoryplot.setDomainGridlinePaint(Color.white); // 横坐标网格线白色
categoryplot.setDomainGridlinesVisible(true); // 可见
categoryplot.setRangeGridlinePaint(Color.white); // 纵坐标网格线白色
// 下面两行使纵坐标的最小单位格为整数
NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
Paint apaint[] = {
new Color(255,0,0),new Color(0,255,0), new Color(255,255,0)
};
CustomRenderer customrenderer = new CustomRenderer(apaint,listMesKanBanItem);
customrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
customrenderer.setBaseItemLabelsVisible(true);
ItemLabelPosition itemlabelposition = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 0.0D);
customrenderer.setBasePositiveItemLabelPosition(itemlabelposition);
customrenderer.setMaximumBarWidth(0.10000000000000001D);//设置圆柱图宽度
// 注意这里是下嗍造型到BarRenderer!
customrenderer.setDrawBarOutline(false); // Bar的外轮廓线不画
categoryplot.setRenderer(customrenderer);
CategoryAxis categoryaxis = categoryplot.getDomainAxis(); // 横轴上的
// Lable
// 标准
categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
categoryaxis.setMaximumCategoryLabelWidthRatio(0.8F);
categoryaxis.setLowerMargin(0.02D);
categoryaxis.setUpperMargin(0.02D);
categoryaxis.setLabelFont(font);
ChartUtilities.applyCurrentTheme(jfreechart);
return jfreechart;
运行后效果如下:
。。。标题和横纵上的都是乱码。。。请高手指点下
- 大小: 21.2 KB
分享到:
相关推荐
自己将jfreechart常用的、柱状图、折线图、饼状图(二维的和三维的)对官网的dome进行了封装和加强,解决了高版本中文乱码问题,数值显示问题、及怎么显示百分比
终极解决方案最简单,最直接的,已解决多台服务器java程序应用jfreechart生成图片,中文乱码问题
Linux下JFreechart中文乱码的解决.docx
jfreechart中文乱码问题解决方案
linux下JFreeChart生成的图片乱码,可以用这个字体
jfreechart生成报表会有乱码问题,这是解决报表乱码的,很好用
JFreeChart用于制表,将数据转化为表格,这个版本不会有中文乱码,推荐
NULL 博文链接:https://blueswind8306.iteye.com/blog/1194209
jfreechart 乱码 问题 jfreechart乱码问题
支持自定义字体,一般不需修改,本例分别为宋体和黑体 如要修改请打开 org/jfree/chart/LocalizationBundle.properties, ...properties文件请用相关的工具修改,不可直接输入中文,需转为unicode字符
1、JFreeChart生成图片路径教程 2、JFreeChart使用教程(含下载安装,超详细) 3、JFreeChart使用详细教程 4、JFreeChart学习--jsp柱状图教程 5、JFreeChart乱码解决方法 等等 包括许多优秀案例
jfreechart linux乱码解决方案,比较完整。
1、JFreeChart生成图片路径教程 2、JFreeChart使用教程(含下载安装,超详细) 3、JFreeChart使用详细教程 4、JFreeChart学习--jsp柱状图教程 5、JFreeChart乱码解决方法 等等 包括csdn上得优秀案例 ------20+M的...
解决jfreechart中文乱码方案整 解决jfreechart中文乱码方案整
zysong.ttf jfreechart 解决中文乱码 问题.zysong.ttf LInux字体库 .用于解决jfreechart在linux环境中的中文乱码问题
Jfreechart 中文乱码的解决方法,网上共享的资源
JFreeChart乱码解决方法 - 企业应用 - Java
解决linux 下,jfreechart乱码
JFreeChart中文乱码问题解决,乱码问题一直是中文在网络时代的关键细节
JFreeChart 中文乱码 解决方案J FreeChart 中文乱码 解决方案