JFreechart餅圖可以獲得複雜而美麗的顏色嗎?我的意思是我怎樣才能達到link中顯示的圖像的顏色?JFreechart漂亮的餅圖
是否可以使用RGB格式,或者您是否需要使用不同的格式?我們該怎麼做。感謝您的幫助
JFreechart餅圖可以獲得複雜而美麗的顏色嗎?我的意思是我怎樣才能達到link中顯示的圖像的顏色?JFreechart漂亮的餅圖
是否可以使用RGB格式,或者您是否需要使用不同的格式?我們該怎麼做。感謝您的幫助
您可以使用PiePlot.setSectionPaint的餅圖的每個切片的RGB值指定顏色。
下面是一個例子:
DefaultPieDataset result = new DefaultPieDataset();
result.setValue("1", 40.);
result.setValue("2", 30.);
result.setValue("3", 20.);
result.setValue("4", 10.);
JFreeChart chart = ChartFactory.createPieChart3D("", result, true, true, false);
PiePlot3D plot = (PiePlot3D) chart.getPlot();
plot.setBackgroundPaint(new Color(255, 255, 255, 0));
plot.setSectionPaint("1", new Color(31, 73, 125));
plot.setSectionPaint("2", new Color(192, 80, 77));
plot.setSectionPaint("3", new Color(155, 187, 89));
plot.setSectionPaint("4", new Color(128, 100, 162));