JFreeChart 3D Pie/Bar Chart - JFreeChart

What are 3D Pie/Bar Charts in JFreeCharts?

3D charts appear in a three-dimensional format. These charts can be used to provide better display and clear information. 3D Pie chart is same as the pie chart but with a nice 3D effect. 3D effect can be achieved by adding a little extra code, which will take care of creating 3D effect in a pie chart.

3D Pie chart

Consider below example to explain mobile sale with the help of a 3D pie chart. Below is a list of different mobile brands and their sale (units per day).

S.No

Mobile Brands

Sales (UNITS per day)

1

Iphone 5S

20

2

Samsung Grand

20

3

MOTO G

40

4

Nokia Lumia

10

Below is the code for creating 3D Pie Chart from the information given above. This code will help you to embed a pie chart in any AWT based application.

Keep the above Java code in PieChart3D.java file, and then compile and run it from the command prompted as

If everything is working fine, it will compile and run to create a JPEG image file named PieChart3D.jpeg having the following 3D Pie Chart

piechart3d.jpg

3D Bar Chart

3D Bar chart is same as bar chart but with a nice 3D effect. 3D effect can achieved by adding a little extra code, which will take care of creating 3D effect in a bar chart. Consider below example which depicts different car statistics with the help of a 3D bar chart. Below is a list of car brands along with their various characteristics shown using a bar chart

Car

Speed

User Rating

Millage

Safety

FIAT

1.0

3.0

5.0

5.0

AUDI

5.0

6.0

10.0

4.0

FORD

4.0

2.0

3.0

6.0

Below code creates 3D Bar Chart from the above given information. This code will help you to embed a bar chart in any AWT based application.

Keep the above Java code in BarChart3D.java file, and then compile and run it from the command prompted as

If everything is working fine with your environment, it will compile and run to create a JPEG image file BarChart3D.jpeg having below 3D Bar Chart

barchart3d.jpg

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JFreeChart Topics