I did the coding to create a pie chart file in png format file,
the pie chart shows the percentage but in the bottom of the file,
I want the percentage to appear in the chart itself,
This is the codes I have used,
String query = "SELECT name,flag from mawarid";
JDBCPieDataset dataset = new JDBCPieDataset(
"jdbc:oracle:thin:@ 127.0.0.1:1521:XE", "oracle.jdbc.OracleDriver",
"", "");
dataset.executeQuery(query);
JFreeChart chart = ChartFactory.createPieChart("Test", dataset, true,
true, false);
try{
PiePlot plot = (PiePlot) chart.getPlot();
plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0} {2}"));
final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
final File file1 = new File("Chart5.png");
ChartUtilities.saveChartAsPNG(file1, chart,600 , 400,info);
}
catch(Exception e)
{
}