Line Chart Series Color, Legent Color Changing when we add Series Items at runtime

2 posts, 0 answers
  1. Gopi
    Gopi avatar
    8 posts
    Member since:
    Apr 2012

    Posted 14 Dec 2012 Link to this post

    Hi Team,

    we are using the RadChart control to display Line chart. The MVVM model used to bind the datasource to chart. We have defined the pallete brushes to Series, Legend colors. At run time only we are adding Items in datasource. When we add new series to datasource, the it is created with previous series item color (both legend and series) and the previous series item is getting a new color.

    But this shouldn;t happen, once the series is created, it should not lose it's color (both Series, legend) till application is closed.

    Actual Result :

    1. Setting the Empty DataSource to the Grid (this time no data will be displayed to the chart)
    2. Adding "Item1" to the datasource. A new series is created for "Item1" with Red Color say for an example. (Both Legend, and series holds Red).
    3. After some time adding "Item2" to the datasource, this time "Item2" is getting the Red Color for both Legend and series and "Item1" is getting a new color.

    Expected Result :
    1. "Item 1" shold not lose its color "RED" till the application closed.
    2. "Item 2" should be created with a new color in the Pallete ratherthan taking it from Previous.

    Can you please provide some help on this to achieve the expected result ?

    Thanks in Advance.

    Gopi V
  2. Petar Kirov
    Petar Kirov avatar
    425 posts

    Posted 19 Dec 2012 Link to this post

    Hi Gopi,

    I made small project in order to reproduce the issue, but I couldn't. When a new Line Series is added, the previous one preserves its color, and the new one takes the next color from the palette. Note that the RadChart exposes the PaletteBrushesRepeat property, which by default is true. This means that when the number of series exceeds the number of user defined palette brushes, the coloring will start from the beginning of the palette brushes collection. If the property is set to false, the next colors will be taken from the theme palette.

    I have attached the sample project for reference.
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top