I have a data bound Gantt chart that I need to have the bars in a series show as the same color but not be grouped together. I need the bars to be individually shown on their own row in sequential time order. If I set the SeriesLablesColumnIndex to a column that identifies the color groups I need, and the ColorModel to CustomLinear or CustomSkin, the color is the same for the group but of course all in that series group together in rows. I can set the SeriesLablesColumnIndex to another data column to get the bars to show individually on rows in sequential time order but then the colors change according to the Color Model selected which has nothing to do with the groups I need. To complicate things the data set changes based on a user defined query. There are 11 different groups of data that may show in various sequences and not all 11 may show each time.
So perhaps there are two options here:
First, can the Series be told to retain the color grouping scheme but ignore the row grouping so the bars can be shown individually on rows by time sequence?
Or, can the individual bars be colored based on a value in the data set even though the data set results change each time the Gantt chart is called?
Sorry for not understanding you earlier. I'd suggest using a dynamic array and keeping an index variable yourself. So as you go through you check if you need a color, if you do, you add it and increment the index. If you ever need more room you just resize the array, usually to twice its capacity for special performance reasons. You could also use an ArrayList and then just copy what you need over to an array when you actually set the CustomPalette. If you google "arrayList in vb.net" or "dynamic arrays in vb.net" you'll get plenty of sites explaining how to use them properly.
Good luck and let me know how it goes. -Paul
The number of color (or bars on the chart) will be variable (ie. anything from 1 to X). Each bar will be set to a color according to what it represents. So the line would be
Dim ChartColors() as Color = {tColor1, tColor2, ..., tColorX}
The X is determined as the page runs. The problem is I can't find the syntax for building the line on the fly.
Neil
If you're just trying to create an array containing the two colors than you could just replace the line:
Dim ChartColors() as Color = {t1}
with:
Dim ChartColors() as Color = {tColor1, tColor2}
I'm not sure this is what you want to do, but hopefully it is. If it isn't let me know and I'll try to help. To clarify, what do you mean by "create t1 as the combined tColor1 and tColor2" especially the "combined" part.
Paul,
Sorry, I didn't give enough info. This is being used in a Gantt Chart. Each color is used for a bar in the chart. In creating the chart, there will be a different number of bars each time. Therefore I need to fill the palette according to the number of bars.
So, as you can see I'm not trying to create a new color, but a palette containing a different color per bar.
There might be an easier way, but personally I would just take the two colors and average them manually. That is to say take the Red, Green, and Blue components and average them to create your new color.
Hope this helps -Paul