Bubble Charts without X Coordinate
The first type of bubble chart available in Chart FX is Bubble
Chart that compares a set of two values with one of the values
specifying the size of the bubble marker.
To pass data simply set a chart with two data series and
set Bubble to the Gallery property as follows:
chart1.setGallery(Gallery.BUBBLE); chart1.openData(COD.VALUES, 2, 5); for (int j=0;j<5;j++) {
chart1.setValue(0,j,<Bubble Y Value as double>);
chart1.setValue(1,j,<Bubble Size as double>); } chart1.closeData(COD.VALUES);
|
After setting these values the bubble chart should look like:

Using a secondary Y-axis to control the size of the bubble
In some cases, the difference in the values
used as Y Value and Bubble Size is too big to produce a good
chart. For example, if we take the previous example, and we
divide the second series by 10, we will get a chart like this:

Assigning the second series to an extra Y-axis, will allow
you to work with a different scale and control the bubble
size:

Note: Showing the secondary Y-axis is optional.
Bubble charts with an X Coordinate
These bubble charts will compare a set of three values with
one of the values specifying the size of the bubble marker.
Basically, these bubble charts are similar to an XY Plot,
where the bubble position is defined by two coordinates (x,y)
and a third coordinate that specifies the size of the bubble.
To pass data you must open an additional communications channel
to specify the x coordinate with the XValue property,
as follows:
chart1.setGallery(Gallery.BUBBLE); chart1.openData(COD.VALUES, 2, 5); chart1.openData(COD.XVALUES, 1, 5); for (int j=0;j<5;j++) {
chart1.setValue(0,j,<Bubble Y Value as double>);
chart1.setXValue(0,j,<Bubble X Value as double>);
chart1.setValue(1,j,<Bubble Size as double>); } chart1.closeData(COD.VALUES); chart1.closeData(COD.XVALUES);
|
For this type of chart, the bubble is not restricted to a
specific x coordinate but can be painted anywhere in the X
Axis (numerical axis) as described in the XY Plot chapter.
The Volume Property Effect
When creating bubble charts, you must be aware that the Volume
property has a specific effect on the way bubble charts are
displayed as the Size will be divided by the setting in the
Volume property.
For example, if the Volume property is set to 50. It means
that Chart FX for Java will force the marker to occupy 1/2
of the space allotted. When you set the bubble size to 100,
you would expect the bubble to occupy the entire space allotted;
however in this case the bubble will only occupy 1/2 of the
space allotted. Similarly, if the Volume is set to 50 and
the bubble size is 50, the bubble will occupy 1/4 of the space
allotted.
|