This is a migrated thread and some comments may be shown as answers.

How to get DataSeries color

1 Answer 58 Views
Chart
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 12 Oct 2012, 08:45 AM
I want to get the color of the DataSeries.  However, both _chart.DefaultView.ChartArea.DataSeries[0].Definition.Appearance.Fill and _chart.DefaultView.ChartArea.DataSeries[0].Definition.Appearance.Stroke return null.  Is there any other way to get the color?  I can see the series color is green in chart.

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 16 Oct 2012, 12:18 PM
Hello David,

 Unfortunately, there is no way to extract the colors of the visual series due to the way our theming mechanism works. There are two suggestions I can offer you:

1. If you tell us which theme do you use I may send you the default colors of the theme.
2. You can create Custom Palette for your chart, so that you'll know exactly which color corresponds to which series. You can find more information on this here.

Please note that our newest charting component RadChartView has this problem solved. It doesn't rely on theming but on a set of built-in palettes that you may choose from. Extracting the color from them is quite intuitive as you may see from this online demo for example.
In general - we would encourage you to use the new ChartView control for any new project development that you are starting now. Here you will find highlights of features and functionality for the two controls.

Kind regards,
Evgenia
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart
Asked by
David
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or