This topic explains, with code examples, how to use BubbleSeries in the {DataChartName}™ control. Some important conceptual information is provided as well.
The topic is organized as follows:
BubbleSeries belongs to a group of ItemsSource pick:[win-forms=" DataSource"] property to bind any data object that implements the IEnumerable interface (e.g. List, Collection, Queue, Stack). However, each item in this object must have one numeric data column (for the size of a bubble) in addition to two numeric data columns (for X and Y values to position a bubble in the Cartesian coordinate system). These data columns are mapped using RadiusMemberPath, XMemberPath, and YMemberPath properties.
An example of object that meets the criteria listed above is the BubbleDataSample which you can download from the Sample Bubble Data resource and use it in your project. Figure 1 shows a schematic representation of binding data to BubbleSeries in the {DataChartName} control.
Figure 1: Schematic representation of binding data to BubbleSeries in the {DataChartName} control.
This code snippet below demonstrates how to bind sample bubble data to the BubbleSeries.
Figure 2: Sample implementation of the binding data with varius bubble sizes to Bubble Series
Bubble Size Scale is an optional feature of BubbleSeries that determines the sizes of bubbles though the RadiusScale property of the series. This feature is implemented through the SizeScale object. When the radius scale is set, the smallest bubble will be equal to MinimumValue, the largest bubble will be equal to MaximumValue, and all the remaining bubbles will be scaled accordingly. The size scale can be either linear or logarithmic. When the radius scale is not set, each bubble’s size is equal to the value of the RadiusMemberPath column.
Figure 3: Sample implementation of the Bubble Size Scale
The Bubble Brush Scale is an optional feature which determines the color pattern within a single BubbleSeries though the series object’s FillScale property. BubbleSeries support the following brush scales:
-
Custom Brush Scale
-
Value Brush Scale
Each scale has a collection of brushes which defines color pattern. The scales are explained in the sub-sections that follow.
CustomPaletteBrushScale uses the index of a bubble marker to select a brush from the Brushes collection. When the BrushSelectionMode property is set to the Select enumerable value, the bubbles are colored sequentially. When BrushSelectionMode is set to Interpolate, the brush is interpolated based on the bubble’s index and the number of brushes in the collection.
Figure 4: Sample implementation of the Custom Brush Scale
ValueBrushScale uses a set of values from one of the numeric columns in the ItemsSource to determine an interpolated brush for bubbles. The column is specified with FillMemberPath property. This axis scale can be linear or logarithmic. Also, it can have user-specified MinimumValue and MaximumValue. When a range is set on this scale, bubbles with values that fall outside the range do not get a brush from the Brushes collection and are not colored.
Figure 5: Sample implementation of the Value Brush Scale
The BubbleSeries supports the following types of legends:
For details on the supported legends and how to use them with BubbleSeries, refer to the Chart Legends topic.