Xceed Chart for WinForms v4.4 Documentation
Cluster Bar

Welcome to Xceed Chart for WinForms v4.4 > User Guide > Series > Bar Series > Cluster Bar

Cluster bars are created by using several instances of the BarSeries class. The first bar series created must have its MultiBarMode property set to MultiBarMode.Series. The MultiBarMode property of the subsequent bar series must be set to MultiBarMode.Clustered. Stacked bar series are displayed adjacent to each other. The following figure shows a typical clustered bar chart:

 

figure 1.

Creating the Cluster Bar Series

The following example demonstrates how to create a cluster bar chart with two clusters:

VB.NET  

' there is one chart created by default

Dim chart As Chart = CType(chartControl1.Charts(0), Chart)

 

Dim bar1 As BarSeries = CType(chart.Series.Add(SeriesType.Bar), BarSeries)

Dim bar2 As BarSeries = CType(chart.Series.Add(SeriesType.Bar), BarSeries)

 

bar1.MultiBarMode = MultiBarMode.Series

bar2.MultiBarMode = MultiBarMode.Clustered

C#  

// there is one chart created by default

Chart chart = (Chart)chartControl1.Charts[0];

 

BarSeries bar1 = (BarSeries)chart.Series.Add(SeriesType.Bar);

BarSeries bar2 = (BarSeries)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 represented as a percentage of the space in the grid cell that is reserved for the current cluster. The user specifies this value 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 bar clusters will be displayed no space between each other. 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:

VB.NET  

bar1.GapPercent = 30

bar2.GapPercent = 30

C#  

bar1.GapPercent = 30;

bar2.GapPercent = 30;

Related Examples

Windows Forms: Series\Bar\Cluster Bar

See Also

BarSeries