RadChart comes with a versatile collection of preset themes (Summer, Vista, Office). At times you may wish to use one of the predefined themes but customize its appearance a bit to fit your specific scenario / application and the control provides easy mechanism to achieve the desired effect.
RadChart uses the concept of style palettes in order to style the various chart series. There are distinct style palettes for the various series types (Line, Bar, Pie, etc.) and each palette can contain as many style elements as you want -- the first style is applied to the first chart series of the given type, the second -- to the second series, etc. If you are drawing more series than the number of defined styles, the first series that does not have corresponding style, will start from the beginning again (use the first style).
Let us customize the chart series item appearance of a RadChart that defines two line series. In order to customize the line color, you need to override the default palette associated with line series for the respective theme (palettes are always associated with a theme).
First you need to associate the xmlns mappings on your root xml element e.g. Window:
Here is a sample code snippet that overrides the style for the first two line series and they are displayed in Lime and Bisque respectively (the rest of the styles are the default palette styles for the Summer theme but you can customize them as well if you are drawing more than two line series).
Note how we are identifying the series palette to override via the current theme and the ResourceKeyLineStyle string defined in the public utility class ResourceHelper –- if we were customizing Area or Bar series we would have used ResourceKeyAreaStyle / ResourceKeyBarStyle respectively.
Here is the code-behind snippet that defines the actual line series and adds them to the RadChart:
Here is the final chart image:
Hope this helps.
Download the sample application
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
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.