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