Telerik RadCartesian chart ignores global palette change for line series

583 views Asked by At

On changing entries in the palette attached to a Telerik RadCartesianChart a line series always defaults to blue and ignores entries made in the global palette. Code:

<Window x:Class="RadCartesianChart.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    Title="MainWindow" Height="350" Width="525">
<Window.Resources>
    <telerik:ChartPalette x:Key="customPalette" x:Name="customPalette">
        <telerik:ChartPalette.GlobalEntries>
            <!--<telerik:PaletteEntry Fill="#FF1B3BA5" Stroke="#FF1B3BA5"/>-->
            <telerik:PaletteEntry Fill="#FF55A236" Stroke="#FF55A236" />
            <telerik:PaletteEntry Fill="#FFB51E4F" Stroke="#FFB51E4F" />
            <telerik:PaletteEntry Fill="#FFDB843D" Stroke="#FFDB843D" />
            <telerik:PaletteEntry Fill="#FF502400" Stroke="#FF502400" />
            <telerik:PaletteEntry Fill="#FF0CE4E4" Stroke="#FF0CE4E4" />
            <telerik:PaletteEntry Fill="#FFDA25E3" Stroke="#FFDA25E3" />
            <telerik:PaletteEntry Fill="#FFE60B0B" Stroke="#FFE60B0B"/>
        </telerik:ChartPalette.GlobalEntries>
    </telerik:ChartPalette>
</Window.Resources>
<Grid>
    <telerik:RadCartesianChart Palette="{StaticResource customPalette}" Name="cartesianChart">
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:CategoricalAxis />
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis/>
    </telerik:RadCartesianChart.VerticalAxis>
    <telerik:RadCartesianChart.Series>
        <telerik:LineSeries>
                <telerik:LineSeries.DataPoints>
                <telerik:CategoricalDataPoint Category="Apples" Value="20"/>
                <telerik:CategoricalDataPoint Category="Bananas" Value="28"/>
                <telerik:CategoricalDataPoint Category="Oranges" Value="17"/>
                <telerik:CategoricalDataPoint Category="Strawberries" Value="30"/>
            </telerik:LineSeries.DataPoints>
        </telerik:LineSeries>
    </telerik:RadCartesianChart.Series>
    </telerik:RadCartesianChart>
    <Button Content="Button" HorizontalAlignment="Left" Margin="0,2,0,0" VerticalAlignment="Top" Width="75" Click="ButtonBase_OnClick"/>
</Grid>

 private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
    {
        this.cartesianChart.Palette.GlobalEntries.Clear();
        this.cartesianChart.Palette.GlobalEntries.Add(new PaletteEntry(new SolidColorBrush(Colors.Red)));
    }

If I change the chart series to be a bar series this works fine. Please help.

0

There are 0 answers