Examples for defining a ChartPalette?

4 posts, 0 answers
  1. Steven
    Steven avatar
    22 posts
    Member since:
    May 2011

    Posted 06 Jul 2012 Link to this post

    Just looking for an example of setting up a custom palette.  How?

    So instead of:
    <telerik:RadCartesianChart Name="Chart1" Palette="Metro">
    could I instead?
    <telerik:RadCartesianChart Name="Chart1" Palette="SomeOtherStyle">

    In Particular, these members aren't really defined anywhere:
    * AdditionalFill
    * Fill
    * Stroke
    Please define... also please define how the constructors correspond to this.

    Lastly, it would be good to see a palette defition in action (code behind please + XAML based approaches).
  2. Sia
    Sia avatar
    667 posts

    Posted 10 Jul 2012 Link to this post

    Hello Steven,

    You can create a custom palette by using the exposed ChartPalette property:
                    <telerik:PaletteEntry Stroke="Red" />
                    <telerik:PaletteEntry Stroke="Blue" />

    or in code-behind:
    ChartPalette palette = new ChartPalette();
    palette.GlobalEntries.Add(new PaletteEntry(null, new SolidColorBrush(Colors.Red)));
    palette.GlobalEntries.Add(new PaletteEntry(null, new SolidColorBrush(Colors.Blue)));
    this.chart.Palette = palette;

    The GlobarEntries are global for all series in RadChartView, colors specific per series family are defined as follows:

                    <telerik:PaletteEntryCollection SeriesFamily="Line">              
                        <telerik:PaletteEntry Stroke="Red" />
                        <telerik:PaletteEntry Stroke="Blue" />

    Alternatively you can customize the appearance of individual LineSeries through the LineSeries.Stroke property, for AreaSeries - through the AreaSeries.Fill property, and for BarSeries you need to define custom BarSeries.DefaultVisualStyle with TargetType="Border" and add style setter for the Border.Background property.
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft R3 2016 release webinar banner
  4. Colter
    Colter avatar
    10 posts
    Member since:
    Apr 2013

    Posted 28 May 2013 Link to this post

    Hello Telerik,

    Can you explain the use case behind the GlobalEntries versus the SeriesEntries?

    I've been trying to figure this one out and just haven't been able to get to the bottom of it.


  5. Evgenia
    Evgenia avatar
    1396 posts

    Posted 31 May 2013 Link to this post

    Hi Colter,

     The GlobalEntries is a collection of PaletteEntries, which will be used for all types of chart series. The SeriesEntries allows us to specify different collections of PaletteEntries for each type of chart series specified by SeriesFamily property. You may find attached an example that I believe will put some more light on this.
    Some words on the project - having this palette in a chart, the first collection of SeriesEntries will be used for the pie series, the second - for area series and for all other types of series - the GlobalEntries collection. The result.PNG says it all.


    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top