changing line color in a ScatterSeriesDescriptor.Style

3 posts, 0 answers
  1. Don
    Don avatar
    4 posts
    Member since:
    May 2013

    Posted 13 Jun 2013 Link to this post

    How do I change the line color of a chart series when using a ChartSeriesProvider?

    If I'm not using the ChartSeriesProvider, then I do this by setting the "Stroke" property,
    as illustrated here.  This works:

    <telerik:ScatterLineSeries Name="HeadSeries"
        ItemsSource="{Binding Path=DataPoints}"
        XValueBinding="FlowRate"
        YValueBinding="Head"
        PointTemplate="{StaticResource HeadPointTemplate}"
        Stroke="CornflowerBlue">
    </telerik:ScatterLineSeries>

    However, if use the ChartSeriesProvider, the following snippet does not change the line color.

    <
    telerik:ScatterSeriesDescriptor ItemsSourcePath="Item"
       XValuePath="FlowRate"
       YValuePath="Head">
      <telerik:ScatterSeriesDescriptor.Style>
        <Style TargetType="telerik:ScatterLineSeries">
          <Setter Property="PointTemplate" Value="{StaticResource HeadPointTemplate}" />
          <Setter Property="Stroke" Value="CornflowerBlue" />
        </Style>
      </telerik:ScatterSeriesDescriptor.Style>
    </telerik:ScatterSeriesDescriptor>




  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 18 Jun 2013 Link to this post

    Hi Don,

    Setting the Stroke property like this works on my end, however all the series generated by this descriptor have the same stroke. I would suggest using a palette or creating a custom one as shown in this help topic.


    Best regards,
    Ves
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Don
    Don avatar
    4 posts
    Member since:
    May 2013

    Posted 19 Jun 2013 Link to this post

    It turns out that I had a 'Palette="Metro"' declaration that is not shown in the snippets that interfered with Stroke setter.
    <telerik:RadCartesianChart Name="chart" Grid.Row="1" Grid.Column="1" Palette="Metro" >

    When I took that declaration out, then the setter property in the ScatterSeriesDescriptor Style worked as expected.
    <telerik:RadCartesianChart Name="chart" Grid.Row="1" Grid.Column="1" >

    With the Pallete not set in the chart declaration, the Stoke setter property in the style is not ignored.
    <telerik:ScatterSeriesDescriptor ItemsSourcePath="Item"
                                      XValuePath="FlowRate"
                                      YValuePath="Head">
       <telerik:ScatterSeriesDescriptor.Style>
         <Style TargetType="telerik:ScatterLineSeries">
           <Setter Property="PointTemplate" Value="{StaticResource HeadPointTemplate}" />
           <Setter Property="Stroke" Value="CornflowerBlue" />
         </Style>
       </telerik:ScatterSeriesDescriptor.Style>
     </telerik:ScatterSeriesDescriptor>
Back to Top