any easy pie chart library ?

I want to use Pie chart in my  jsp web application.

Could you please suggest me an easy to use  library for pie chart

I am looking for a dynamic pie chart like this ...

you may look at this sample pie chart.  This is the type of pie chart I am looking for.

http://www.conceptdraw.com/How-To-Guide/picture/Percentage-pie-chart-DA-determinations.png
cofactorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gurpsbassiCommented:
I would suggest using D3.js. Very powerful library for data visualisation. You should be able to extract out your data into JavaScript.
http://d3js.org/
cofactorAuthor Commented:
I don't see any pie chart in D3.js .  

I want a very simple and easy to use solution for showing a pie chart like this ..
http://www.conceptdraw.com/How-To-Guide/picture/Percentage-pie-chart-DA-determinations.png

I am very much comfortable with jquery.  But I guess Jquery does not have pie chart.

Does D3.js can help in this regard ?  I am already using Jquery in my web application ....I don't want to use another third party library unless this requirement is filled.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

cofactorAuthor Commented:
>>>http://www.jqchart.com/jquery/chart/ChartTypes/PieChart

one slice is cut out in this example .... can we keep it same as other slices.
Tomas Helgi JohannssonCommented:
Hi!

Read the Doc section :)
I guess that has something to do with the
 explodedSlices: [5],

keywords.
In the example you see the China data (no 5 in the data-array) exploded.

So if you omit the explodeSlices line no slice will be cut out. Likewise if you put
 explodedSlices: [1,5],
both data/slices for United Kingdom and China will be cut out.

Regards,
     Tomas Helgi
gurpsbassiCommented:
I don't see any pie chart in D3.js .  

There are many examples of D3.js pie charts.

Go to the D3.js site and hit examples, you will find a humongous range of examples.
cofactorAuthor Commented:
I am testing JFree chart

I have this code ..

 DefaultPieDataset myServletPieChart = new DefaultPieDataset();
                myServletPieChart.setValue("Maths", 74);
                myServletPieChart.setValue("Physics", 87);
                myServletPieChart.setValue("Chemistry", 62);
                myServletPieChart.setValue("Biology", 92);
                myServletPieChart.setValue("English", 51);        
                JFreeChart mychart = ChartFactory.createPieChart("",myServletPieChart,true,true,false);  
                mychart.setBack
                response.setContentType("image/png"); /* Set the HTTP Response Type */
                ChartUtilities.writeChartAsPNG(out, mychart, 400, 300);

Open in new window



This  generated output like this ...

https://drive.google.com/file/d/0B-XtIZwNPaowSEh6V0hmdU9aeXRJMlM4THBhUmhJMURkc0tz/view?usp=sharing



But I want  to generate output like this...
https://drive.google.com/file/d/0B-XtIZwNPaowS09jLXpxVHR0ck9fUHR1dHBLQkpmVmpUQkVF/view?usp=sharing

Could you please suggest what code I may need to add in my existing snippet ?
Tomas Helgi JohannssonCommented:
cofactorAuthor Commented:
@Tomas,
I am using this
               
mychart.getPlot().setBackgroundPaint(new Color(255,255,255,0));

Open in new window

This sets background as transparent....good.

But you missed another part I asked in JFreechart. I  require  the texts  to be inside the slice.
How do I achieve this ?

please see again my desired output :  

https://drive.google.com/file/d/0B-XtIZwNPaowS09jLXpxVHR0ck9fUHR1dHBLQkpmVmpUQkVF/view?usp=sharing

see the text  "Physics" , "Maths" , "English"  etc are inside the slice.  How do I achieve this ?
Tomas Helgi JohannssonCommented:
Hi!

Maybe this helps
PiePlot plot = (PiePlot) chart.getPlot();
plot.setSimpleLabels(true);

http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/plot/PiePlot.html#setSimpleLabels%28boolean%29
Otherwise for the labels you should look at PieSectionLabelGenerator
You will probably need to implement/extend that class for your needs.

http://www.ktipsntricks.com/data/ebooks/java/jfreechart-1.0.12-A4.pdf

Regards,
     Tomas Helgi
cofactorAuthor Commented:
PiePlot plot = (PiePlot) chart.getPlot();
plot.setSimpleLabels(true);

Open in new window


This worked fine. Thank you.

Now I want to change  the color of each slices of my choice.
Could you please tell how to achieve this ?
I dont like default color of  slices.
Tomas Helgi JohannssonCommented:
Hi!

This is achived by using this
plot.setSectionPaint("Apples", Color.black);
plot.setSectionPaint("Oranges", new Color(120, 0, 120));

I gave you an example on that in my earlier post :)
This one
https://javabeanz.wordpress.com/2007/08/06/creating-pie-charts-using-custom-colors-jfreechart/

Regards,
    Tomas Helgi
cofactorAuthor Commented:
I am confused as to where to use your code in my existing snippet.

My present code is ..

DefaultPieDataset dataset = new DefaultPieDataset();
                dataset.setValue("XXXXXXXXXXXXXXX", 40);
                dataset.setValue("yyyyyyyy", 30);
                dataset.setValue("ZZZZZZZZZZZZZZZZZZZZZZ", 30);
                    
                JFreeChart mychart = ChartFactory.createPieChart("",dataset,true,true,false);  
                mychart.getPlot().setBackgroundPaint(new Color(255,255,255,0));
                
                PiePlot plot = (PiePlot) mychart.getPlot();
                plot.setSimpleLabels(true);
                
                response.setContentType("image/png"); 
                ChartUtilities.writeChartAsPNG(out, mychart, 400, 300);

Open in new window


As you see I have 3 different slice in this code.

Now how do I give

slice  XXXXXXXXXXXXXXX  to color  yellow
slice  yyyyyyyy  to color  pink
slice  ZZZZZZZZZZZZZZZZZZZZZZ to color  black

I don't understand where to fit your code into my existing snippet.  Could you please take a look at it.

Thanks
Tomas Helgi JohannssonCommented:
HI!

Something like this (after line 10 in your code

plot.setSectionPaint("XXXXXXXXXXXXXXX", Color.yellow);
plot.setSectionPaint("ZZZZZZZZZZZZZZZZZZZZZZ", Color.black);
plot.setSectionPaint("yyyyyyyy", Color.pink);

Regards,
     Tomas Helgi

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cofactorAuthor Commented:
Thanks. This filled my requirement perfectly.
cofactorAuthor Commented:
Excellent
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.