JFreeChart时序图
来源:互联网 发布:iphone抹除数据 编辑:程序博客网 时间:2024/06/05 18:18
使用的jfreecart版本为jfreechart-1.0.14.jar,如果要使用jfreechart,还必须要导入其依赖包jcommon,使用的版本为jcommon-1.0.17.jar
下图展示了所使用的jfreechart基本类之间的关系:
public class charttest {public static void main(String[] args) {JFreeChart chart = ChartFactory.createTimeSeriesChart("示例", "x轴名称", "y轴名称", getDataSet(), true, false, false);chart.getTitle().setFont(new Font("宋体", Font.PLAIN, 12));//标题chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 12));//图例XYPlot plot = chart.getXYPlot();//图表DateAxis x = (DateAxis)plot.getDomainAxis();//x轴x.setLabelFont(new Font("宋体", Font.PLAIN, 12));//x轴名称字体x.setTickLabelFont(new Font("宋体", Font.PLAIN, 12));//x轴节点字体x.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd HH:mm"));//x轴节点格式NumberAxis y = (NumberAxis)plot.getRangeAxis();//y轴y.setLabelFont(new Font("宋体", Font.PLAIN, 12));//y轴名称字体y.setTickLabelFont(new Font("宋体", Font.PLAIN, 12));//y轴节点字体NumberFormat nf = NumberFormat.getInstance();nf.setMaximumFractionDigits(1);y.setNumberFormatOverride(nf);//y轴节点格式XYLineAndShapeRenderer render = (XYLineAndShapeRenderer) plot.getRenderer();//图表式样plot.setBackgroundPaint(Color.LIGHT_GRAY);//背景颜色 plot.setDomainGridlinePaint(Color.green);//网格竖线颜色 plot.setRangeGridlinePaint(Color.green);//网格横线颜色render.setBaseShapesVisible(true);//显示节点FileOutputStream output;try {output = new FileOutputStream("D:\\test.jpg");ChartUtilities.writeChartAsPNG(output, chart, 450, 400);} catch (Exception e) {e.printStackTrace();}}private static XYDataset getDataSet(){TimeSeriesCollection tsSet = new TimeSeriesCollection();TimeSeries ts = new TimeSeries("test");ts.add(new Day(1, 1, 2013), 11.1);ts.add(new Day(2, 1, 2013), 12.2);//ts.add(new Month(2, 2013), 133);//ts.add(new Month(3, 2013), 111);tsSet.addSeries(ts);return tsSet;}}
显示的结果为:
- jfreechart做时序图
- JFreeChart时序图
- JFreechart画时序图
- JFreeChart时序图
- JFreeChart中的时序图
- 利用JFreeChart生成时序图
- JFreeChart最佳实践:时序图
- JFreeChart应用实例-时序图
- JFreeChart -- 时序图实例解析
- JFreeChart -- 时序图实例解析
- jfreechart 时序图 ,生成图表
- JFreeChart—输出时序图
- JFreeChart -- 时序图实例解析 -- 多条时序线
- JFreeChart -- 时序图实例解析 -- 多条时序线
- JFreeChart学习(一)-JfreeChart中的timeSeries(时序图)使用示例
- jfreechart时序图和组合图
- #.JFreeChart 图表生成实例(饼图、柱状图、折线图、时序图)
- 通过JfreeChart画柱状图、时序图、K线图
- Android opengl es 2.0怎么学习
- 818健康那点事,随便纪念下于娟
- OVER(PARTITION BY column_name1 ORDER BY column_name2) 用法 及 ROW_NUMBER\RANK\DENSE_RANK的区别
- Java OutOfMemoryError 汇总
- Windows环境下面搭建Objective-C开发环境
- JFreeChart时序图
- 在C语言中利用PCRE实现正则表达式
- Java 集合框架 性能分析
- Hdu1151 Air Raid
- iPhone/Mac Objective-C内存管理教程和原理剖析(三)@property (retain)和@synthesize的默认实现
- JNI调用Java方法
- 网站前端性能分析
- iPhone/Mac Objective-C内存管理教程和原理剖析(四)系统自动创建新的autorelease pool
- cxGrid技巧汇总