jfreechart和echart(和echarts比哪些是jfreechart的优势)

本文目录
- 和echarts比哪些是jfreechart的优势
- struts2怎样整合jreechart
- java 报表实现这种图形功能 jfreechart可以实现吗
- JFreeChart能做成双曲线图吗帮忙一下
- jfreechart和hightchart还有Echart的关联和区别
- 如何用jfreechart显示饼状图,数据来自我的数据库当中求具体代码
和echarts比哪些是jfreechart的优势
建议你都尝试下。我用的echarts多点,中文文档比较详细。可查的资料也多。但是highcharts有3d的图表,echarts好像没有3d的。
struts2怎样整合jreechart
JFreeChart与struts2整合实例
1. 3个jar包
jcommon,jfreechart,strust2-jfreechart-plugin
2
1 《?xml version="1.0" encoding="UTF-8"?》
***隐藏网址***
3 《struts》
4 《package name="default2" namespace="/" extends="jfreechart-default,struts-default"》
5 《action name="resultAction" class="com.goshop.action.ShowResultAction" 》
6 《result name="success" type="chart"》
7 《param name="width"》400《/param》
8 《param name="height"》300《/param》
9 《/result》
10 《/action》
11 《/package》
12 《/struts》
3.
1 package com.goshop.action;
2
3 import java.awt.Font;
4 import java.util.List;
5
6 import javax.annotation.Resource;
7
8 import org.jfree.chart.ChartFactory;
9 import org.jfree.chart.JFreeChart;
10 import org.jfree.chart.axis.CategoryAxis;
11 import org.jfree.chart.axis.NumberAxis;
12 import org.jfree.chart.plot.CategoryPlot;
13 import org.jfree.chart.plot.PlotOrientation;
14 import org.jfree.data.category.DefaultCategoryDataset;
15 import org.springframework.stereotype.Controller;
16
17 import com.goshop.domain.VoteOption;
18 import com.goshop.service.IVoteOptionService;
19 import com.opensymphony.xwork2.ActionSupport;
20
21 @Controller
22 public class ShowResultAction extends ActionSupport {
23
24 private int voteID;
25 private int channelID;
26
27 public int getVoteID() {
28 return voteID;
29 }
30
31 public void setVoteID(int voteID) {
32 this.voteID = voteID;
33 }
34
35 public int getChannelID() {
36 return channelID;
37 }
38
39 public void setChannelID(int channelID) {
40 this.channelID = channelID;
41 }
42
43 @Resource
44 private IVoteOptionService optionService;
45 private JFreeChart chart;
46
47 public void setChart(JFreeChart chart) {
48 this.chart = chart;
49 }
50 public JFreeChart getChart(){
51
52 List《VoteOption》 voteOptionList = optionService
53 .selectVoteOptionsByVoteId(voteID);
54 DefaultCategoryDataset ds = new DefaultCategoryDataset();
55 for (VoteOption option : voteOptionList) {
56 ds.addValue(option.getTicketNum(), option.getVoteOptionName(), "");
57 }
58 JFreeChart chart = ChartFactory.createBarChart("球星投票结果", "投票选项", "投票数",
59 ds, PlotOrientation.VERTICAL, true, false, false);
60 CategoryPlot categoryplot = (CategoryPlot) chart.getPlot();
61 NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
62 CategoryAxis domainAxis = categoryplot.getDomainAxis();
63
64 /*------设置X轴坐标上的文字-----------*/
65 domainAxis.setLabelFont(new Font("sans-serif", Font.PLAIN, 11));
66 /*------设置X轴的标题文字------------*/
67 domainAxis.setLabelFont(new Font("宋体", Font.PLAIN, 12));
68 /*------设置Y轴坐标上的文字-----------*/
69 numberaxis.setTickLabelFont(new Font("sans-serif", Font.PLAIN, 12));
70 /*------设置Y轴的标题文字------------*/
71 numberaxis.setLabelFont(new Font("黑体", Font.PLAIN, 12));
72
73 /*------这句代码解决了底部汉字乱码的问题-----------*/
74 chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 12));
75 /******* 这句代码解决了标题汉字乱码的问题 ********/
76 /******* 这句代码解决了标题汉字乱码的问题 ********/
77 chart.getTitle().setFont(new Font("宋体", Font.PLAIN, 12));
78
79 return chart;
80 }
81
82 public String execute() throws Exception {
83 return "success";
84 }
85 }
java 报表实现这种图形功能 jfreechart可以实现吗
jfreechart绘制很困难,可旦迹枣模拆以试试jquery实现的图州基表控件:highcharts、jqueryplot什么的
JFreeChart能做成双曲线图吗帮忙一下
过来人劝你在有选择的情况下不要用jFreeChart,功能少不说还不好看,可以考虑用Jqchart或者Highchart,还有百度的Echart(不过只兼容IE8以上)
jfreechart和hightchart还有Echart的关联和区别
ireport是一个报表模板工具,它是个可视化的模板工具,做好的报表模板,它是结合jasperreport来使用的,通过jasperreport的类来为模板填充数据来得到我们想要的报表。jfreechart是一个图表式的报表,像饼图,曲线图什么的。现在ireport这个报表工具可以把jfreechart集成到报表里面。
如何用jfreechart显示饼状图,数据来自我的数据库当中求具体代码
/*
* 生成3D饼状图
*/
public static JFreeChart buildeChartAsPieChart3D(String title,
List《TimeSeriesDataBean》 list) {
FontCtl.setFont();// 解决乱码问题
List《String》();
String ss;
for (TimeSeriesDataBean bean : list) {
ss = new String;
ss = bean.getNam();
ss = bean.getVal() + "";
dataList.add(ss);
}
DefaultPieDataset dataset = DataSetBuilder.buildPieChartDataSet(title,
dataList);
JFreeChart chart = ChartFactory.createPieChart3D(title, dataset, true,
true, false);
// chart.addSubtitle(new TextTitle("SUBTITLE测试"));
PiePlot pieplot = (PiePlot) chart.getPlot();
// {0}:({1})% 代表显示格式 : 0 = 名称 1 = 值 比如 : 名称:19%
StandardPieSectionLabelGenerator standarPieIG = new StandardPieSectionLabelGenerator(
"{0}:({1})", NumberFormat.getNumberInstance(), NumberFormat
.getPercentInstance());
pieplot.setLabelGenerator(standarPieIG);
// 没有数据的时候显示的内容
pieplot.setNoDataMessage("无数据显示");
pieplot.setLabelGap(0.02D);
PiePlot3D pieplot3d = (PiePlot3D) chart.getPlot();
// 设置开始角度
pieplot3d.setStartAngle(120D);
// 设置方向为”顺时针方向“
pieplot3d.setDirection(Rotation.CLOCKWISE);
// 设置透明度,0.5F为半透明,1为不透明,0为全透明
pieplot3d.setForegroundAlpha(0.7F);
ChartFrame frame = new ChartFrame(title, chart);
frame.pack();
frame.setVisible(true);
return chart;
}

更多文章:
session已过期重新授权(苹果手机session过期怎么恢复啊)
2026年3月8日 10:00
scrapy中间件(scrapy框架中setting中中间件数字大的先执行么)
2026年8月22日 13:45
matlab定义变量并赋初值(在matlab中用输入量给变量赋值)
2026年6月11日 15:00
程序设计语言是如何通过a b+1的(C语言中c=(a+b,a++,b+1);什么意思)
2026年6月29日 19:30
apache中国官网(中国sns交友网站排行前十名分别是什么)
2025年6月30日 20:45
eclipse创建的项目在哪里(Eclipse的src文件在哪里啊)
2026年8月31日 03:15
什么是函数?js正则查找match()与替换replace()用法实例
2025年9月29日 19:00
frameset标签的属性(在html标签中的frameset是什么标签 又有哪些属性和值)
2025年12月6日 02:15
translate最新消息(‘请以最新的信息为准’ 怎么翻译)
2026年6月5日 08:00
thymeleaf使用ajax(如何在Thymeleaf中实现ajax请求url的可靠构造)
2025年6月24日 09:00













