0

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)
        {

        }
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by Taywin
0

Hmm... You are using a library which is not a standard library? You may need to look at JFreeChart site for any information. I am sorry that I cannot help you because I don't use the library.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.