📄 charreportimpl.java
字号:
JFreeChart chart = ChartFactory.createPieChart3D(datasetObj
.getTextTitle(), datasetObj.getDefaultpiepdataset(), datasetObj
.isLegend(), datasetObj.isTooltip(), datasetObj.isUrl());
PiePlot plot = (PiePlot) chart.getPlot();
setPiePlot(plot);
return chart;
}
public JFreeChart pie2DMultiple(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createMultiplePieChart(datasetObj
.getTextTitle(), datasetObj.getCategorydataset(), datasetObj
.getTableorder(), datasetObj.isLegend(),
datasetObj.isTooltip(), datasetObj.isUrl());
return chart;
}
public JFreeChart pie3DMultiple(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createMultiplePieChart3D(datasetObj
.getTextTitle(), datasetObj.getCategorydataset(), datasetObj
.getTableorder(), datasetObj.isLegend(),
datasetObj.isTooltip(), datasetObj.isUrl());
return chart;
}
public JFreeChart ring(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createRingChart(datasetObj
.getTextTitle(), datasetObj.getPiedataset(), datasetObj
.isLegend(), datasetObj.isTooltip(), datasetObj.isUrl());
return chart;
}
public JFreeChart scatter(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createScatterPlot(datasetObj
.getTextTitle(), datasetObj.getXTitle(),
datasetObj.getYTitle(), datasetObj.getXyseriescollection(),
datasetObj.getPlotorientation(), datasetObj.isLegend(),
datasetObj.isTooltip(), datasetObj.isUrl());
XYPlot plot = (XYPlot) chart.getPlot();
setXYSeriesPlot(plot);
return chart;
}
public JFreeChart histogram(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createHistogram(datasetObj
.getTextTitle(), datasetObj.getXTitle(),
datasetObj.getYTitle(), datasetObj.getXyseriescollection(),
datasetObj.getPlotorientation(), datasetObj.isLegend(),
datasetObj.isTooltip(), datasetObj.isUrl());
XYPlot plot = (XYPlot) chart.getPlot();
setXYSeriesPlot(plot);
return chart;
}
public JFreeChart bubble(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createBubbleChart(datasetObj
.getTextTitle(), datasetObj.getXTitle(),
datasetObj.getYTitle(), datasetObj.getXyzdataset(),
datasetObj.getPlotorientation(), datasetObj.isLegend(),
datasetObj.isTooltip(), datasetObj.isUrl());
return chart;
}
public JFreeChart gantt(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createGanttChart(datasetObj
.getTextTitle(), datasetObj.getXTitle(),
datasetObj.getYTitle(),
datasetObj.getIntervalcategorydataset(), datasetObj.isLegend(),
datasetObj.isTooltip(), datasetObj.isUrl());
return chart;
}
public JFreeChart highLow(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createHighLowChart(datasetObj
.getTextTitle(), datasetObj.getXTitle(),
datasetObj.getYTitle(), datasetObj.getDefaultohlcdataset(),
false);
return chart;
}
public JFreeChart candlestick(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createCandlestickChart(datasetObj
.getTextTitle(), datasetObj.getXTitle(),
datasetObj.getYTitle(), datasetObj.getDefaultohlcdataset(),
false);
return chart;
}
public JFreeChart polar(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createPolarChart(datasetObj
.getTextTitle(), datasetObj.getXyseriescollection(), datasetObj
.isLegend(), datasetObj.isTooltip(), datasetObj.isUrl());
return chart;
}
public JFreeChart waterFall(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createWaterfallChart(datasetObj
.getTextTitle(), datasetObj.getXTitle(),
datasetObj.getYTitle(), datasetObj.getCategorydataset(),
datasetObj.getPlotorientation(), datasetObj.isLegend(),
datasetObj.isTooltip(), datasetObj.isUrl());
CategoryPlot plot = (CategoryPlot) chart.getPlot();
setCategoryPlot(plot);
return chart;
}
public JFreeChart waferMap(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createWaferMapChart(datasetObj
.getTextTitle(), datasetObj.getWafermapdataset(), datasetObj
.getPlotorientation(), datasetObj.isLegend(), datasetObj
.isTooltip(), datasetObj.isUrl());
return chart;
}
public JFreeChart timeSeries(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory.createTimeSeriesChart(datasetObj
.getTextTitle(), datasetObj.getXTitle(),
datasetObj.getYTitle(), datasetObj.getXydataset(),
datasetObj.isLegend(), datasetObj.isTooltip(), datasetObj
.isUrl());
return chart;
}
public JFreeChart windPlot(DatasetObj datasetObj) throws Exception {
JFreeChart chart = ChartFactory
.createWindPlot(datasetObj.getTextTitle(), datasetObj
.getXTitle(), datasetObj.getYTitle(), datasetObj
.getWinddataset(), datasetObj.isLegend(), datasetObj
.isTooltip(), datasetObj.isUrl());
return chart;
}
/**
* 设置 CategoryPlot 属性
*/
private static void setCategoryPlot(CategoryPlot plot) {
plot.getDomainAxis().setVisible(true);
plot.getDomainAxis().setLabelFont(new Font("宋体", Font.PLAIN, 12));
plot.getDomainAxis().setLabelPaint(Color.BLACK);
plot.getDomainAxis().setTickLabelFont(new Font("宋体", Font.PLAIN, 12));
plot.getDomainAxis().setTickLabelPaint(Color.BLACK);
plot.getDomainAxis().setTickLabelsVisible(true);
plot.getRangeAxis().setVisible(true);
plot.getRangeAxis().setLabelFont(new Font("宋体", Font.PLAIN, 12));
plot.getRangeAxis().setLabelPaint(Color.BLACK);
plot.getRangeAxis().setTickLabelFont(new Font("宋体", Font.PLAIN, 12));
plot.getRangeAxis().setTickLabelPaint(Color.BLACK);
plot.getRangeAxis().setVerticalTickLabels(false);
plot.getRangeAxis().setLabelAngle(0.0D);
NumberAxis numberaxis = (NumberAxis) plot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
plot.setDomainGridlinesVisible(true);
plot.setRangeGridlinesVisible(true);
}
/**
* 设置 PiePlot 属性
*/
private static void setPiePlot(PiePlot plot) {
plot.setStartAngle(150D);
plot.setDirection(Rotation.CLOCKWISE);
plot.setForegroundAlpha(0.5F);
}
/**
* 设置 BarRenderer属性
*/
private static void setBarRenderer(BarRenderer barrenderer,
CategoryPlot plot, CategoryDataset categorydataset) {
barrenderer.setMaximumBarWidth(0.10D);
barrenderer.setItemMargin(0.10D);
NumberAxis numberAxis = new NumberAxis("");
plot.setRangeAxis(1, numberAxis);
plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
plot.setDataset(1, categorydataset);
plot.setRenderer(1, new LineAndShapeRenderer());
plot.mapDatasetToDomainAxis(1, 0);
plot.mapDatasetToRangeAxis(1, 1);
}
/**
* 设置 XYPlot 属性
*/
private static void setXYSeriesPlot(XYPlot plot) {
plot.getDomainAxis().setVisible(true);
plot.getDomainAxis().setLabelFont(new Font("宋体", Font.PLAIN, 12));
plot.getDomainAxis().setLabelPaint(Color.BLACK);
plot.getDomainAxis().setTickLabelFont(new Font("宋体", Font.PLAIN, 12));
plot.getDomainAxis().setTickLabelPaint(Color.BLACK);
plot.getDomainAxis().setTickLabelsVisible(true);
plot.getRangeAxis().setVisible(true);
plot.getRangeAxis().setLabelFont(new Font("宋体", Font.PLAIN, 12));
plot.getRangeAxis().setLabelPaint(Color.BLACK);
plot.getRangeAxis().setTickLabelFont(new Font("宋体", Font.PLAIN, 12));
plot.getRangeAxis().setTickLabelPaint(Color.BLACK);
plot.getRangeAxis().setVerticalTickLabels(false);
plot.getRangeAxis().setLabelAngle(0.0D);
plot.setDomainGridlinesVisible(true);
plot.setRangeGridlinesVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -