DefaultPieDataset dataset = new DefaultPieDataset();
dataset.setValue("Category 1", 43.2);
dataset.setValue("Category 2", 27.9);
dataset.setValue("Category 3", 79.5);
// create a chart...
JFreeChart chart = ChartFactory.createPieChart(
"Sample Pie Chart",
dataset,
true, // legend?
true, // tooltips?
false // URLs?
);
// create and display a frame...
ChartFrame frame = new ChartFrame("First", chart);上面代码直接来自手册,我在加上下面这句,还是不行
chart.setBackgroundPaint(Color.WHITE);我的版本:jfreechart-1.0.13
dataset.setValue("Category 1", 43.2);
dataset.setValue("Category 2", 27.9);
dataset.setValue("Category 3", 79.5);
// create a chart...
JFreeChart chart = ChartFactory.createPieChart(
"Sample Pie Chart",
dataset,
true, // legend?
true, // tooltips?
false // URLs?
);
// create and display a frame...
ChartFrame frame = new ChartFrame("First", chart);上面代码直接来自手册,我在加上下面这句,还是不行
chart.setBackgroundPaint(Color.WHITE);我的版本:jfreechart-1.0.13
CategoryPlot plot = (CategoryPlot) jfreechart.getPlot();
// 背景色 透明度
plot.setBackgroundAlpha(0.5f);
// 前景色 透明度
plot.setForegroundAlpha(0.5f);