饼图显示百分比
来源:互联网 发布:midi音乐软件 编辑:程序博客网 时间:2024/05/17 07:47
环境:JDK1.4.2
JFreeChart: jfreechart-1.0.6
看见有的人Blog里面要"饼图显示百分比"是用这个类
原来在1.0.0-rc1版中显示百分比已经调整到StandardPieItemLabelGenerator构造函数中了,StandardPieItemLabelGenerator有三个构造函数。StandardPieItemLabelGenerator()不显示各项所占比例。另外两个可以显示比例。代码如下:
plot.setLabelGenerator(new StandardPieItemLabelGenerator(StandardPieItemLabelGenerator.DEFAULT_TOOLTIP_FORMAT));
//或者采用下面自定义样式显示,{0}表示选项,{1}表示数值,{2}表示所占比例
plot.setLegendLabelGenerator(new StandardPieItemLabelGenerator("{0}: ({1}M, {2})"));
//或者采用下面自定义样式显示,{0}表示选项,{1}表示数值,{2}表示所占比例
plot.setLegendLabelGenerator(new StandardPieItemLabelGenerator("{0}: ({1}M, {2})"));
但是我用的是jfreechart-1.0.6这个版本,以上的StandardPieItemLabelGenerator,StandardPieItemLabelGenerator这2个类已经取消了换成了
StandardPieItemLabelGenerator------->>>>StandardPieSectionLabelGenerator (1.0.6版本)
StandardPieItemLabelGenerator------->>>>StandardPieToolTipGenerator (1.0.6版本)
StandardPieItemLabelGenerator------->>>>StandardPieToolTipGenerator (1.0.6版本)
我实现 “百分比”的方法如下:
//设置百分比
plot.setLabelGenerator(new StandardPieSectionLabelGenerator(StandardPieToolTipGenerator.DEFAULT_TOOLTIP_FORMAT));
plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}=({1}M, {2})"));
plot.setLabelGenerator(new StandardPieSectionLabelGenerator(StandardPieToolTipGenerator.DEFAULT_TOOLTIP_FORMAT));
plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}=({1}M, {2})"));
具体的代码 请看我下面的文章
JFreeChart+sql 生成饼图
- 饼图显示百分比
- highcharts 饼图显示数量和百分比
- EXTJS6.0 饼图图例显示以及百分比显示
- MSChart饼图显示百分比-------牵手的博客
- Cognos 10.1 饼图百分比小数点显示的问题
- 快逸V5实现饼图数据显示百分比
- 润乾报表V5饼图显示百分比数据
- 润乾报表饼图显示百分比数据
- [VC++]如何让MSChart的饼图显示百分比
- 解决jquery jqplot pierenderer 饼图百分比小于3的无法显示DataLabels
- echars图表玫瑰饼图隐藏LableLine与内部区域显示百分比
- MSChar显示百分比
- 饼图中显示百分比方法
- python 百分比显示
- 输出结果显示百分比
- 电池百分比显示
- HighCharts柱状图显示百分比
- php 百分比显示
- 矩阵转置
- 病毒发起ARP欺骗攻击造成网络断网
- webSphere/webLogic/JBoss技术网站
- Windows Mobile 5.0编程—奥运场馆速查
- 充QQ币的疯狂 宽带环境下的网络安全
- 饼图显示百分比
- Tomcat并发性问题-
- web服务器和应用服务器的区别
- PHP - Manual手册 - 第20章 异常处理 - 用异常处理php改进流程
- 赛门铁克:网络攻击模块化工具增多
- 从各种弊端来看网站服务器问题
- 解答微软的一道逻辑推理题
- JBoss,webSphere,webLogic应用服务器学习经验
- PHP - 下载 - Zend Guard 5.0