I need to make a pie chart like the image in link below:
http://www.raunakkathuria.com/images/jf ... echart.jpg
The pie that I have made is shown in link below:
http://www.raunakkathuria.com/images/jf ... actual.jpg
I need to change the look and feel of label link lines and removing them for some section that are very close to the Pie chart sections as shown in Pi
My sample code is
Code: Select all
DefaultPieDataset dataset = createDataset();
// create a chart...
JFreeChart chart = ChartFactory.createPieChart(
"",
dataset,
false, // legend?
true, // tooltips?
false // URLs?
);
chart.setBackgroundPaint(Color.WHITE);
PiePlot plot = (PiePlot) chart.getPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setSectionPaint("GIC/Stable Value", new Color(154, 152, 101));
plot.setSectionPaint("Bond", new Color(103, 101, 50));
plot.setSectionPaint("Balanced", new Color(54, 51, 10));
plot.setSectionPaint("Lifestyle", new Color(250, 202, 102));
plot.setSectionPaint("Large US Equity", new Color(204, 102, 2));
plot.setSectionPaint("Mid US Equity", new Color(102, 52, 2));
plot.setSectionPaint("Small US Equity", new Color(50, 0, 0));
plot.setSectionPaint("International", new Color(204, 204, 204));
plot.setSectionPaint("Emerging Market", new Color(149, 149, 149));
plot.setSectionPaint("Specialty", new Color(90, 90, 90));
plot.setSectionPaint("Company Stock", new Color(51, 51, 51));
plot.setSectionPaint("Window", new Color(0, 0, 0));
plot.setSectionPaint("Money Market", new Color(205, 203, 154));
plot.setLabelGenerator(new CustomLabelGenerator());
plot.setLabelBackgroundPaint(Color.WHITE);
plot.setLabelOutlinePaint(Color.white);
plot.setLabelShadowPaint(Color.WHITE);
plot.setLabelGap(0.0001);
plot.setLabelLinkMargin(0.0);
// create and display a frame...
ChartFrame frame = new ChartFrame("", chart);
frame.pack();
frame.setVisible(true);
Thanks
Raunak