jfreechart实现java画图

jfreechart实现java画图

ID:37511826

大小:236.50 KB

页数:13页

时间:2019-05-24

jfreechart实现java画图_第1页
jfreechart实现java画图_第2页
jfreechart实现java画图_第3页
jfreechart实现java画图_第4页
jfreechart实现java画图_第5页
资源描述:

《jfreechart实现java画图》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、packagecom.dsc.utils;importjava.awt.Color;importjava.awt.Font;importjava.awt.RenderingHints;importjava.io.File;importjava.io.IOException;importorg.jfree.chart.ChartFactory;importorg.jfree.chart.ChartUtilities;importorg.jfree.chart.JFreeChart;importorg.jfree.chart.axis.NumberAxis;i

2、mportorg.jfree.chart.axis.ValueAxis;importorg.jfree.chart.labels.StandardXYItemLabelGenerator;importorg.jfree.chart.plot.PlotOrientation;importorg.jfree.chart.plot.XYPlot;importorg.jfree.chart.renderer.xy.XYLineAndShapeRenderer;importorg.jfree.chart.title.TextTitle;importorg.jfree

3、.data.xy.XYSeries;importorg.jfree.data.xy.XYSeriesCollection;importorg.jfree.ui.RectangleInsets;publicclassJfreeChartUtils_Line{/***@parampictureTitle图表标题*@paramxTitlex轴标题*@paramyTitley轴标题*@paramdataset数据集*@paramwidth宽度*@paramheight高度*@return图片的路径*/publicStringcreateLinePicture(St

4、ringpictureTitle,StringxTitle,StringyTitle,XYSeriesCollectiondataset,intwidth,intheight){Stringpath="";JFreeChartchart=ChartFactory.createXYLineChart(pictureTitle,yTitle,xTitle,dataset,PlotOrientation.VERTICAL,true,true,false);chart.setBackgroundPaint(Color.LIGHT_GRAY);//设置图表属性//取

5、得CategoryPlot,设定Plot参数XYPlotplot=chart.getXYPlot();//设置网格背景颜色plot.setBackgroundPaint(Color.white);//设置网格竖线颜色plot.setDomainGridlinePaint(Color.pink);//设置网格横线颜色plot.setRangeGridlinePaint(Color.pink);//设置是否显示垂直网格线plot.setDomainGridlinesVisible(true);//设置是否显示水平网格线plot.setRangeGridline

6、sVisible(true);XYLineAndShapeRendererxylineandshaperenderer=(XYLineAndShapeRenderer)plot.getRenderer();//设置曲线图与xy轴的距离plot.setAxisOffset(newRectangleInsets(0D,0D,0D,10D));//设置曲线是否显示数据点xylineandshaperenderer.setItemLabelGenerator(newStandardXYItemLabelGenerator());xylineandshaperend

7、erer.setBaseShapesVisible(true);//是否显示数据点的值xylineandshaperenderer.setBaseItemLabelsVisible(true);//X轴整数显示NumberAxisx=(NumberAxis)plot.getDomainAxis();x.setStandardTickUnits(NumberAxis.createIntegerTickUnits());//Y轴整数显示NumberAxisy=(NumberAxis)plot.getDomainAxis();y.setStandardTickU

8、nits(NumberAxis.createIntegerTick

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。