I don't know what's going on. I tried to set the line colors in the line chart. If I set it line by line, it's working fine. If however, I use a for loop to set the paint element, the lines become black. Any idea why?
For example: (set it line by line)
ultraChart1.ColorModel.ModelStyle =
ColorModels.CustomSkin;
ultraChart1.ColorModel.Skin.PEs.Add(new PaintElement(color));
ultraChart1.ColorModel.Skin.PEs.Add(
new PaintElement(color1));
For example: (set it in a loop)
for (int i = 0; i < 10; i++)
{
ultraChart1.ColorModel.Skin.PEs.Add(new PaintElement(color + 1));
}
That worked, but I had to add:
Color[] colors = new Color[] { Color.Blue, Color.Orange }; ------>UltraChart1.ColorModel.ModelStyle = ColorModels.CustomLinear; UltraChart1.ColorModel.CustomPalette = colors;
To make the colors show one per line.
Thanks for the help.
Please take a look at the attached sample for more details and let me know if you have any questions.
Regards
Hello Mike,
If you want to acheive desired look and feel, maybe you could try the code below:
Color[] colors = new Color[] { Color.Red, Color.Orange };
ultraChart1.ColorModel.CustomPalette = colors;
By this way you will get:
Thanks for the video, it is a linechart. I made that change in the front end and had the thickness at 5. When I added:
Color[] colors = new Color[] { Color.Blue, Color.Orange }; UltraChart1.ColorModel.ModelStyle = ColorModels.CustomSkin; for (int i = 0; i < 2; i++) { UltraChart1.ColorModel.Skin.PEs.Add(new PaintElement(colors[i])); }
to specify the line colors the line became 1px thick. I went back in the front end and checked the thickness to ensure it hadn't changed, it had not, it is still set at 5.
Thanks for provided code, but there is missing information about the chart`s type that you are using. Please tell me what is your chart type? If you are using LIneChart, then please take a look at the attached video file for more deatils.
If you are using composite chart, then you could use the code from my previous post where myColumnLayer is instance from ChartLayerAppearance class.
Let me know if you have any question