Nevron .NET Vision Documentation
Cluster Bar

Cluster Bar charts are composed of several bar or float-bar series. The data points from the same category are displayed side-by-side, forming "clusters" along the X axis. This representation is convenient when you need to compare the Y values for a given category or X value. The following figure shows a typical Cluster Bar chart:

Figure 1.

Creating the bar series

Cluster Bar charts are displayed with several NBarSeries or NFloatBarSeries objects. The MultiBarMode property of the first bar series must be set to MultiBarMode.Series. For the subsequent series the MultiBarMode property must be set to MultiBarMode.Clustered. The following example demonstrates how to create a cluster bar chart with two series:

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

NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);
NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

bar1.MultiBarMode = MultiBarMode.Series;
bar2.MultiBarMode = MultiBarMode.Clustered;
Visual Basic
Copy Code
' obtain a reference to the Cartesian chart that is created by default
Dim chart As NCartesianChart = chartControl.Charts(0)

Dim bar1 As NBarSeries = chart.Series.Add(SeriesType.Bar)
Dim bar2 As NBarSeries = chart.Series.Add(SeriesType.Bar)

bar1.MultiBarMode = MultiBarMode.Series
bar2.MultiBarMode = MultiBarMode.Clustered
Controlling the gap between the clusters

The gap between the clusters is controlled in percents of the space in the grid cell which is reserved for the current cluster. The users specifies this percent with the help of the GapPercent property which is by default set to 15. If the GapPercent properties of all bar series are set to 0 the bars will be displayed without any space between them. On the other hand, if the GapPercent properties are set to 100 the bars will be displayed with 0 width. The following example increases the default gap space:

Copy Code
bar1.GapPercent = 30;
bar2.GapPercent = 30;
Visual Basic
Copy Code
bar1.GapPercent = 30
bar2.GapPercent = 30
Related Examples
Windows forms: Chart Gallery\Bar\Cluster Bar
See Also



©2017. Nevron Software LLC.

Send Feedback