4
我想改变我的JFreeChart PieChart3D馅饼“块”的颜色的颜色,这是使饼图代码:更改jfreechart的饼图
<% response.setContentType("image/png"); %><%@page import="org.jfree.data.general.*"%><%@page import="org.jfree.chart.*"%><%@page import="org.jfree.chart.plot.*"%><%@page import="java.awt.Color" %><%
DefaultPieDataset ds = (DefaultPieDataset)session.getAttribute("usagePieOutputDataset");
JFreeChart chart = ChartFactory.createPieChart3D
(
null, // Title
ds, // Dataset
false, // Show legend
false, // Use tooltips
false // Configure chart to generate URLs?
);
chart.setBackgroundPaint(Color.WHITE);
chart.setBorderVisible(false);
PiePlot3D plot = (PiePlot3D)chart.getPlot();
plot.setDepthFactor(0.0);
plot.setLabelGenerator(null); //null means no labels
plot.setLabelOutlinePaint(Color.LIGHT_GRAY);
plot.setLabelFont(new java.awt.Font("Arial", java.awt.Font.BOLD, 10));
ChartUtilities.writeChartAsPNG(response.getOutputStream(), chart, 150, 144);
%>
任何帮助,高度赞赏。
如何检索'可比key'?是否有'plotPie'对象的方法?我试过['plot.getSectionKey(index)'](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/plot/PiePlot.html#getSectionKey(int)),但它是保护... – Manu 2012-10-16 09:10:50