if (type == SPIDER) {
AdvancedSpiderWebPlot plot = new AdvancedSpiderWebPlot(dataset);
chart = new JFreeChart(title, titleFont, plot, groupNames != null);
if (labelFormat != null) {
plot.setLabelGenerator(new StandardCategoryItemLabelGenerator(
labelFormat, NumberFormat.getNumberInstance(), new DecimalFormat(
"0.0%")));
}
plot.setLabelFont(labelFont);
if (keys != null) {
plot.setMaxValue(Double.parseDouble(keys[0]));
}
} else {
if (type == LINE) {
chart = ChartFactory.createLineChart(title, keys[0], keys[1],
dataset, PlotOrientation.VERTICAL, groupNames != null, false,
false);
} else {
chart = ChartFactory.createBarChart(title, keys[0], keys[1], dataset,
type == VBAR ? PlotOrientation.VERTICAL
: PlotOrientation.HORIZONTAL, groupNames != null, false,
false);
}
CategoryPlot plot = chart.getCategoryPlot();
// 设置显示值的数字
AbstractCategoryItemRenderer renderer = (AbstractCategoryItemRenderer) plot
.getRenderer();
if (labelFormat != null) {
renderer.setBaseItemLabelFont(labelFont);
renderer.setBaseItemLabelsVisible(true);
renderer
.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
}
if (type == LINE) {
// 线条模式设置显示节点图形
((LineAndShapeRenderer) renderer).setBaseShapesVisible(true);
}