Hi, I have a column chart as shown in the screenshot.
I want to set fixed colors for each column within a series. For example, I want the first column in "Total" to always be red and second column to always be green.
If I set colormodel to be customskin and add a set of PEs, both columns in each series get the same color.
Is there a way to set fixed colors for each column in a series?
Thanks a lot.
OH Never mind, all I have to do is set
UC1.ColorModel.Skin.ApplyRowWise = False
Thanks a lot. :)
Hi Nasa, thanks for the reply. That worked but it just gave me the same result as if I didn't set any ModelStyle or CustomPalette.
What I'm trying to do is that I have two checkboxes, each representing a column of data in the datatable. Say the D1 column is set to red, and D2 column is set to green. When I uncheck the D1 checkbox, I want D2 to stay green instead of becoming red.
My data table looks something like this:
Category | D1 | D2
Total 4882890 4882904
5ms 4881772 4882232
10ms 1029 578
20ms 1075 1069
30ms 36 30
I tried with this following code,
UC1.ColorModel.ModelStyle = Infragistics.UltraChart.Shared.Styles.ColorModels.CustomSkin For i = 0 To aColor_Index.Count - 1 UC2.ColorModel.Skin.PEs.Add(aChart_Colors(aColor_Index(i))) Next
where I have a set of PaintElement in the aChart_Colors array, and I have indexes of all checked boxes in aColor_Index. So when I uncheck something, the unchecked index will not be in aColor_Index anymore, and the color at that index in aChart_Colors won't appear. This works perfectly on line chart and scatter chart, but on column chart, this code makes both columns in "Total" red, and both columns in "5ms" green, and then both columns in "10ms" red again, both in "20ms" green, and so on. I want the first column in "Total" to be red and second column in "Total" to be green. and then when I uncheck the green one, "Total" will just have 1 column and it's red.
Maybe I should change the format of my datatable? I tried many things but no success. Any suggestion is greatly appreciated. Thanks a lot.
Hi,
You can assign a specific colour to each column in a series using the ColorModel object. Have test with following code in Page_Load event handler:
this.UltraChart1.ColorModel.ModelStyle = ColorModels.CustomLinear;
Color[] ChartColors;
ChartColors = new Color[] {Color.Red, Color.Green};
this.UltraChart1.ColorModel.CustomPalette = ChartColors;