Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
205
Gantt Chart Colors
posted

Hi, I need to be able to separately set the color of each of the bars in a Gantt chart.

I have managed to use the custom palette but this seems to change all of the bars in a series to the same color, I need to be able to change the color of each bar. Can this be done?

I have seen mention of using a GanttSeries, in which fine tuning of the bar attributes can be undertaken, but can find no examples of how to use this, help would be appreciated.

The code I have used is below:

cht.GanttChart.Columns.SeriesLabelsColumnIndex = 0

cht.GanttChart.Columns.ItemLabelsColumnIndex = 1

cht.GanttChart.Columns.StartTimeColumnIndex = 2

cht.GanttChart.Columns.EndTimeColumnIndex = 3

cht.GanttChart.Columns.IDColumnIndex = 4

cht.GanttChart.Columns.LinkToColumnIndex = 5

cht.GanttChart.Columns.PercentCompleteColumnIndex = 6

cht.GanttChart.Columns.OwnerColumnIndex = 7

Dim t1 As System.Drawing.Color

Dim t2 As System.Drawing.Color

t1 = Drawing.Color.Blue

t2 = Drawing.Color.Yellow

Dim ChartColors() As System.Drawing.Color = {t1, t2, t1, t2, t1, t2, t1, t1, t2, t1, t2, t1, t2, t1}

Me.cht.ColorModel.ModelStyle = Infragistics.UltraChart.Shared.Styles.ColorModels.CustomLinear

Me.cht.ColorModel.CustomPalette = ChartColors

Me.cht.DataSource = sqlds Me.cht.DataBind()

 

Thanks, Richard