JFreeChart Bubble Chart - JFreeChart

What is the use of Bubble Chart in JFreeChart?

This chapter will give you detailed description on how to use JFreeChart for creating Bubble Chart from a given set of business data. Bubble chart displays information in three-dimensional way and a bubble is plotted at the place where (x, y) coordinate intersect. Size of the bubble is considered as range or quantity of X and Y axis.

Business Data

For example consider different persons along with their age, weight, and work capacities. Work capacity can be treated as number of hours which is plotted as bubbles in the chart.

WEIGHT

AGE

30

40

50

60

70

80

10

4

WORK

20

5

30

10

40

8

50

9

60

6

AWT Based Application

Below is the code for creating Bubble Chart from the above given information and this code will help you to embed a Bubble chart in any AWT based application.

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

If everything is working fine, it will compile and run to generate the following Bubble Graph

bubblechart_awt.jpg

JPEG Image Creation

Re-write the above example for generating a JPEG image from a command line.

Keep the above Java code in BubbleChart_image.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 BubbleChart.jpeg in your current directory.

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

JFreeChart Topics