How to get DataSeries color

2 posts, 0 answers
  1. David
    David avatar
    4 posts
    Member since:
    May 2012

    Posted 12 Oct 2012 Link to this post

    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.
  2. Evgenia
    Evgenia avatar
    1397 posts

    Posted 16 Oct 2012 Link to this post

    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,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top