jfreechart线图柱图饼图散点图Word文档格式.docx

上传人:b****4 文档编号:7278382 上传时间:2023-05-08 格式:DOCX 页数:42 大小:22.72KB
下载 相关 举报
jfreechart线图柱图饼图散点图Word文档格式.docx_第1页
第1页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第2页
第2页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第3页
第3页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第4页
第4页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第5页
第5页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第6页
第6页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第7页
第7页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第8页
第8页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第9页
第9页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第10页
第10页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第11页
第11页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第12页
第12页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第13页
第13页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第14页
第14页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第15页
第15页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第16页
第16页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第17页
第17页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第18页
第18页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第19页
第19页 / 共42页
jfreechart线图柱图饼图散点图Word文档格式.docx_第20页
第20页 / 共42页
亲,该文档总共42页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

jfreechart线图柱图饼图散点图Word文档格式.docx

《jfreechart线图柱图饼图散点图Word文档格式.docx》由会员分享,可在线阅读,更多相关《jfreechart线图柱图饼图散点图Word文档格式.docx(42页珍藏版)》请在冰点文库上搜索。

jfreechart线图柱图饼图散点图Word文档格式.docx

*/

publicvoidcreateLineChart(){

//设置数据

cddata=newDefaultCategoryDataset();

for(inti=0;

i<

datas.length;

i++){

if(datas[i].length==0){

cddata.setValue(null,"

"

categoryKeys[i]);

}else{

for(intj=0;

j<

datas[i].length;

j++){

cddata.setValue(datas[i][j],descriptionKeys[j],categoryKeys[i]);

}

}

}

/**数据

System.out.println("

**************************datasbegin:

**************************"

);

for(intj=0;

System.out.println(categoryKeys[i]+"

:

"

+descriptionKeys[j]+"

|"

+datas[i][j]);

}

**************************datasend:

****************************"

chart=ChartFactory.createLineChart(title,//图表标题

x,//目录轴的显示标签

y,//数值轴的显示标签

cddata,//数据集

PlotOrientation.VERTICAL,//图表方向:

水平、垂直

true,//是否显示图例(对于简单的柱状图必须是false)

true,//是否生成工具

false);

//是否生成URL

CategoryPlotplot=chart.getCategoryPlot();

plot.setBackgroundPaint(newColor(238,244,255));

//设置图表的颜色

plot.setDomainGridlinePaint(Color.lightGray);

//设置垂直网格线的颜色

plot.setRangeGridlinePaint(Color.lightGray);

//设置水平网格线的颜色

plot.setDomainGridlinesVisible(true);

//设置垂直网格线是否显示

plot.setRangeGridlinesVisible(true);

//设置水平网格线是否显示

LineAndShapeRendererlineandshaperenderer=(LineAndShapeRenderer)plot.getRenderer();

lineandshaperenderer.setBaseShapesVisible(true);

lineandshaperenderer.setBaseShapesFilled(true);

chart.setBackgroundPaint(Color.white);

setChartFont("

}

*饼图

publicvoidcreatePieChart(){

dpdata=newDefaultPieDataset();

//生成JFreeChart对象

Doubled=0.0;

descriptionKeys.length;

d=d+(datas[j][i]==null?

0:

datas[j][i]);

dpdata.setValue(descriptionKeys[i],d.doubleValue());

chart=ChartFactory.createPieChart(title,dpdata,true,true,true);

PiePlotplot=(PiePlot)chart.getPlot();

//设置图表的颜色

plot.setNoDataMessage("

没有数据!

plot.setLabelGenerator(newStandardPieSectionLabelGenerator(

("

{0}:

({2})"

),

NumberFormat.getNumberInstance(),

newDecimalFormat("

0.00%"

)));

PieChart"

publicvoidcreatePieChartValue(Double[]value){

dpdata.setValue(descriptionKeys[i],value[i]);

plot.setLabelGenerator(null);

plot.setToolTipGenerator(newStandardPieToolTipGenerator(("

{0}"

LegendTitlelegend=chart.getLegend();

legend.setBackgroundPaint(newColor(238,244,255));

//图例背景

legend.setItemFont(newFont("

宋体"

Font.ITALIC,12));

//图例的字体

legend.setPosition(RectangleEdge.RIGHT);

//图例位置

legend.setHeight(1000.00);

*柱图

publicvoidcreateBarChart(){

chart=ChartFactory.createBarChart(title,//图表标题

cddata,//数据集

水平、垂直

true,//是否显示图例(对于简单的柱状图必须是false)

true,//是否生成工具

false//是否生成URL

);

//设置图表的颜色

publicvoidcreateBarChart3D(Object[]data){

data.length;

cddata.setValue((Number)data[i],categoryKeys[i],categoryKeys[i]);

chart=ChartFactory.createBarChart3D(title,//图表标题

*对比柱状图

publicvoidcreateBarChart(CategoryDatasetdataset){

dataset,//数据集

*面积图

publicvoidcreateAreaChart(){

chart=ChartFactory.createAreaChart(title,//图表标题

*X,Y线图chart

*paramchartMap

*/

publicvoidcreateXYLineChart(Map<

String,Map<

Double,Double>

>

chartMap){

//创建XYDataset对象(准备数据)

xydata=createXYDataset(chartMap);

//创建JFreeChart对象:

ChartFactory.createXYLineChart

chart=ChartFactory.createXYLineChart(title,//标题

x,//categoryAxisLabel(category轴,横轴,X轴标签)

y,//valueAxisLabel(value轴,纵轴,Y轴的标签)

xydata,//dataset

PlotOrientation.VERTICAL,

true,//legend

true,//tooltips

true);

//URLs

//使用CategoryPlot设置各种参数。

以下设置可以省略。

XYPlotplot=(XYPlot)chart.getPlot();

//x轴整数显示

NumberAxisna=(NumberAxis)plot.getDomainAxis();

na.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

XYLineAndShapeRendererrenderer=(XYLineAndShapeRenderer)plot.getRenderer();

renderer.setBaseItemLabelsVisible(true);

renderer.setBaseShapesVisible(true);

renderer.setBaseShapesFilled(true);

plot.setRenderer(0,renderer);

XYChart"

*双y轴曲线图,没有折线点

*paramcddata

publicvoidcreateXYsLineChart(DefaultCategoryDatasetcddataLeft,DefaultCategoryDatasetcddataRight){

//设置字体样式

Fontfs=newFont("

微软雅黑"

Font.BOLD,12);

Fontf=newFont("

Font.PLAIN,12);

chart=ChartFactory.createLineChart(title,//标题

cddataLeft,//dataset

CategoryPlotplot=(CategoryPlot)chart.getPlot();

//设置X坐标的显示方式(默认水平)

CategoryAxiscategoryaxis=plot.getDomainAxis();

categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);

categoryaxis.setCategoryMargin(9);

//分类轴边距

//左边y轴显示方式

//NumberAxisnumberaxis=(NumberAxis)plotxy.getRangeAxis();

//y轴整数显示

NumberAxisnumberaxis=newNumberAxis(this.y);

numberaxis.setLabelFont(fs);

numberaxis.setTickLabelFont(f);

plot.setRangeAxis(0,numberaxis);

//右边y轴显示方式

NumberAxisnumberaxis2=newNumberAxis(this.y2);

numberaxis2.setLabelFont(fs);

numberaxis2.setTickLabelFont(f);

plot.setRangeAxis(1,numberaxis2);

plot.setDataset(1,cddataRight);

plot.mapDatasetToRangeAxis(1,1);

//y轴(左边)

LineAndShapeRendererrenderer=(LineAndShapeRenderer)plot.getRenderer();

renderer.setSeriesStroke(0,newBasicStroke(1.6F));

//y轴(右边),绘制单元对象LineAndShapeRenderer

LineAnd

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2