Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set percentage on PieChart? #10

Open
GoogleCodeExporter opened this issue Sep 23, 2015 · 0 comments
Open

How to set percentage on PieChart? #10

GoogleCodeExporter opened this issue Sep 23, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

The pie chart showing the percentage with the label


What version of the product are you using? On what operating system?
0.0.4... Android 3.2

Please provide any additional information below.

I Want to show the percentage with the labels on the pie chart.

I was reading the sample, and I can't put the percentage...

createDataset:

dataset.setValue(series1, new Double(1.0));
        dataset.setValue(series2, new Double(4.0));
        dataset.setValue(series3, new Double(3.0));
        dataset.setValue(series4, new Double(5.0));
        dataset.setValue(series5, new Double(23.50));
        dataset.setValue(series6, new Double(13.27));
        dataset.setValue(series7, new Double(8.27));
        dataset.setValue(series8, new Double(22.12));
        dataset.setValue(series9, new Double(35.39));
        dataset.setValue(series10, new Double(15.14));
        dataset.setValue(series11, new Double(18.12));
        dataset.setValue(series12, new Double(0.0));


private static AFreeChart createChart(PieDataset dataset) {

        AFreeChart chart = ChartFactory.createPieChart(
                "", // chart title
                dataset, // data
                true, // include legend
                true,
                true);
        TextTitle title = chart.getTitle();
        title.setToolTipText("A title tooltip!");


        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setLabelFont(new Font("SansSerif", Typeface.NORMAL, 12));
        plot.setNoDataMessage("No data available");
        plot.setCircular(false);
       // plot.setLabelGap(0.02);
       // plot.setSimpleLabels(true);
        //plot.setExplodePercent(key, percent)
        plot.setExplodePercent(148.81, 1);

        return chart;

    }


Original issue reported on code.google.com by rafaelde...@gmail.com on 7 May 2012 at 7:23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant