java利用jfreechart怎么成立时序统计图呢?我和大师分享一下怎么成立时序图, 我写的经验对你进修java有帮忙的话, 给我投票、点赞或者保藏!
1java利用jfreechart建造3d条形图
1java利用jfreechart绘制线型统计图
1java利用jfreechart绘制条形统计图

文章插图
需要这些哦
eclipse、jfreechart
方式/
1eclipse新建一个java项目, 名称为javachart 。

文章插图
2在项目中增添freechart文件 。

文章插图
3在项目中新建一个本家儿类 。
package javachart;
public class javachart {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}

文章插图
4在main中新建一个窗口, 显示统计图 。
public static void main(String[] args) {
// TODO Auto-generated method stub
JFrame jf=new JFrame();
jf.setSize(600,500);
jf.setLocationRelativeTo(null);
jf.setVisible(true);
}

文章插图
5在类中界说时序的数据, 返回XYDataset类型的函数:
public static XYDataset shuju(){
TimeSeries ts=new TimeSeries("数据");
Day day = new Day(1, 1, 2018);
double d = 100D;
for (int i = 0; i < 365; i++) {
d = d + (Math.random() - 0.5) ;
ts.add(day, d);
day = (Day) day.next();
}
TimeSeriesCollection tc =new TimeSeriesCollection(ts);
return tc;
}

文章插图
6生当作2018时序统计图:
public static JFreeChart tongjitu(){
StandardChartTheme standardChartTheme = new StandardChartTheme("CN");
standardChartTheme.setExtraLargeFont(new Font("宋书", Font.BOLD, 25));
standardChartTheme.setRegularFont(new Font("宋书", Font.PLAIN, 15));
standardChartTheme.setLargeFont(new Font("宋书", Font.PLAIN, 15));
ChartFactory.setChartTheme(standardChartTheme);
JFreeChart chart = ChartFactory.createTimeSeriesChart("2018产物发卖统计图","月份","发卖金额(万)", shuju(),false, false,false);
XYPlot plot = chart.getXYPlot();
plot.setDomainGridlinesVisible(true);
DateAxis da = (DateAxis) plot.getDomainAxis();
DateFormat format = new SimpleDateFormat("MM");
DateTickUnit dt = new DateTickUnit(DateTickUnit.DAY,30,format);
da.setTickUnit(dt);
return chart;
}

文章插图
7在窗口中显示统计图:
推荐阅读
- excel怎么插入和使用数据透视表
- 3Dmax如何使用编辑多边形边界
- 美图秀秀的逼真场景怎么使用
- 美图秀秀的非主流场景怎么使用
- premiere的裁剪怎么使用
- 抖音复古胶卷四连拍怎么使用胶片雕刻时光
- 快速上手 使用VuePress写博客
- 如何在微信使用360桌面助手
- 怎样使用中国移动App亲密付
- 怎样使用前程无忧APP创建简历找工作