Getting color series

david

I have a radchart and personalized chartlegend. In my chartlegend I have a checkbox and I need to get the color that has given radchart sets. But when I try to know the color, in "aparrence" fields appear all to null, but really if you are painting with a certain color.

Evgenia

Unfortunately, there is no easy way to extract the colors of the visual series and use it to manually generate legend items. There are two workarounds though that you may choose from:
1. You can set the color of your series using the appearance API exposed by the SeriesDefinition object and set exactly the same color to the legend item for each visual series.Here is a sample code demonstrating how to use the appearance API:

ISeriesDefinition def = new LineSeriesDefinition();

def.Appearance.Fill = new SolidColorBrush(Colors.Yellow);

def.Appearance.Foreground = new SolidColorBrush(Colors.Green);

def.Appearance.Stroke = new SolidColorBrush(Colors.White);

2. You might create your own custom Palette and apply it to the Chart as shown in our documentation. When the underlying data is changed, you can add/remove/alter the palette brushes accordingly, in order to preserve the logical correlation between some serie and its corresponding Color. Check this online example with source code provided where you will see how we keep the relation between a color and series because when a series is not visible (the corresponding checkbox is unchecked), it is actually hidden. Please mind that even though the example is made under Silverlight, the code is practically the same for WPF.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.