Nevron .NET Vision Documentation
Bubble

Bubble Charts are a convenient way for graphical representation of multi-dimensional data. The data points are displayed as circles (or other shapes) with variable parameters (size, position etc.) that depend on the input data. For example a 2D Bubble Chart can represent a data set with up to 4 dimensions: X position, Y position, Size and Color. The following pictures show 2D and 3D bubble charts:



Figure 1.

Figure 2.

Creating a bubble series

Bubble series are represented by the NBubbleSeries type. An instance of this type must be added to the series collection of a Cartesian chart.

C#
Copy Code
// obtain a reference to the Cartesian chart that is created by default
NCartesianChart chart = (NCartesianChart)chartControl.Charts[0];

// add a bubble series to it
NBubbleSeries bubble = (NBubbleSeries)chart.Series.Add(SeriesType.Bubble);
Visual Basic
Copy Code
' obtain a reference to the Cartesian chart that is created by default
Dim chart As NCartesianChart = chartControl.Charts(0)

' add a bubble series to it
Dim bubble As NBubbleSeries = chart.Series.Add(SeriesType.Bubble)
Passing Data

Once the bubble series is created you can add some data in it. Bubble series use the Values data series for the Y positions, the XValues data series for the X positions, the ZValues data series for Z positions.

In addition to these data series the bubble series provides another data series of type Double, which holds the bubble sizes. It is accessible through the Sizes property of NBubbleSeries object.

You can either manipulate directly these data series, or use the data point interface to supply data to the bubble series. The NBubbleDataPoint class provides several constructors that can be very helpful when you add bubble data points. Please refer to the Working with Data Points topic for more information.

Controlling the shape of the bubbles

The shape of the bubbles can be controlled through the BubbleShape property. It accepts values from the PointShape enumeration. For example the following code will display the bubbles as spheres:

C#
Copy Code
bubble.BubbleShape = PointShape.Sphere;
Visual Basic
Copy Code
bubble.BubbleShape = PointShape.Sphere
Controlling the bubble sizes

You can specify the display sizes of the smallest and the largest bubbles through the MinSize and MaxSize properties. They are by default set to 2.5f and 12.5f Model units respectively. The following code will increase the size of all bubbles with 1 Model unit:

C#
Copy Code
bubble.MinSize = 3.5f;
bubble.MaxSize = 13.5f;
Visual Basic
Copy Code
bubble.MinSize = 3.5F
bubble.MaxSize = 13.5F
Formatting Commands

The NBubbleSeries class extends the formatting commands set inherited from the NXYZScatterSeries class with the following formatting commands:

<size> - the current data point bubble size (obtained from the Sizes data series)

The following code will display the bubble sizes in the legend

C#
Copy Code
bubble.Legend.Mode = SeriesLegendMode.DataPoints;
bubble.Legend.Format = "<size>";
Visual Basic
Copy Code
bubble.Legend.Mode = SeriesLegendMode.DataPoints
bubble.Legend.Format = "<size>"
Z Order Considerations
The Ellipse, Cross, DiagonalCross and Star styles display bubbles that do not have depth dimension when displayed in 3D. This makes possible for Nevron Chart to apply Z order on them so that the bigger bubbles never overlap the smaller ones. If your 3D bubble chart is likely to have overlapped bubbles it is recommended to use these bubble styles.
Related Examples
Windows forms: Chart Gallery\Bubble\Standard Bubble
See Also

 

 


©2017. Nevron Software LLC.

Send Feedback