4.1.4 Bubble Series

Bubble Series

This series draws bubbles. It uses ChartDataModel as its data model. KEYS specify Bubbles position on x-axis, VALUES specify Bubbles position on y-axis and EXTENTS specify bubbles' sizes. Also bubbles' sizes are adjusted to axis in such way - from EXTENT values largest and smallest are found, and then their ratio is calculated.

Setting BubbleSeries:

1
2
3
4
5
//setting BubbleSeries object named bubble where
//   dataModel is an instance of ChartDataModel
//   xMapper and yMapper - instances of AxisMapper
BubbleSeries bubble = new BubbleSeries(dataModel, new PlaneMapper2D(),
				xMapper, yMapper);

Bubble Series Demonstration

Figure 4.1.4.1 Bubble Series Demonstration

View Source

Other Bubble Series Properties

Radius

If there is a need for a specific ration, by which diameters of bubbles will be found, it is possible to set it using setBubblesRadiusRange method. The first parameter indicates minimum radius of bubbles and the second - maximum radius of bubbles. If range values are from interval [0;1] then bubbles will be enlarged n times, where n is equal to max and min difference. If range is more than 1, then bubbles will be shrunken n times, where n is equal to max and min difference.

For instance, there is such chart:

Bubble Series Demonstration

Figure 4.1.4.2 Bubble Series Demonstration with default range

 
bubble.setBubblesRadiusRange(0.1,0.9);

Bubble Series Demonstration - Enlarged

Figure 4.1.4.2 Bubble Series Demonstration - Enlarged

View Source

Shapes

There is a possibility to set bubble series shapes. Types of shapes available:

Setting shape:

 
bubble.setPrimitive(Shapes.PYRAMID_SHAPE);