Chart / Charts / Chart Types / Cartesian / Series / Bubble Series
In This Topic
    Bubble Series
    In This Topic

    Bubble charts offer a convenient visual representation of multidimensional data. In a bubble chart data points are displayed as circles (or other shapes) with variable parameters such as size, position, and color that depend on the input data. The following images show typical bubble charts in 2D and 3D:

     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
    NBubbleSeries bubble = new NBubbleSeries();
    chart.Series.Add(bubble);
    
     Passing Data

    The bubble series accepts data points of type NBubbleDataPoint. The following code snippet shows how to add data to a bubble series:

    C#
    Copy Code
    NBubbleDataPoint bubbleDataPoint = new NBubbleDataPoint();
    bubbleDataPoint.X = 10;
    bubbleDataPoint.Value = 10;
    bubbleDataPoint.Size = 10;
    bubbleDataPoint.Fill = new NColorFill(NColor.Red);
    bubble.DataPoints.Add(bubbleDataPoint);
    
     Controlling the Bubble Sizes

    The size of each bubble in the series is determined by the Size property of the bubble data point, as well as the MinSize and MaxSize properties of the bubble series. MinSize and MaxSize properties regulate the size of the smallest and largest bubbles in the series respectively. The sizes of the other bubbles are interpolated between MinSize and MaxSize based on their Size property value relative to the computed minimum and maximum size value of the bubble series. Below is an example code demonstrating how to set the minimum and maximum bubble sizes of a bubble series:

    C#
    Copy Code
    bubble.MinSize = 10; // specified in dips
    bubble.MaxSize = 50; // specified in dips
    
     Controlling the Bubble Shape

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

    C#
    Copy Code
    bubble.Shape = ENPointShape3D.Sphere;
    
     Formatting Commands

    The bubble series supports the following formatting commands in addition to the standard (per data point) formatting commands:

    <size> - displays the bubble size

     

    See Also