Different bar colours in a bar chart

In DesktopChart in 2023r4, how can I display different bar colours in a bar chart?

Using the DataColor Property

An Example:

// Here we define the Colors
// It's just an Array of Colors. The order of the Colors added to this Array,
// should match the order of the Data within the Chart
Var colors() As Color
For X As Integer = 0 To dataLabel.LastIndex
  Colors.Add Color.RGB(System.Random.InRange(50, 200),System.Random.InRange(50, 200),System.Random.InRange(50, 200))

Var mySet As New ChartCircularDataset("Number", dataItem, colors) // This is where you add the Colors to the Chart
Chart_Penetration.AddDatasets( mySet )
1 Like

Thanks for the example.
So I can do multiple colours on a pie chart with an array, but I can’t do it on a linear dataset for a bar chart?

Exactly :slight_smile:

1 Like