This is a migrated thread and some comments may be shown as answers.

changing line color in a ScatterSeriesDescriptor.Style

2 Answers 257 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 13 Jun 2013, 01:09 PM
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 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 18 Jun 2013, 06:24 AM
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.

0
Don
Top achievements
Rank 1
answered on 19 Jun 2013, 04:20 PM
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>
Tags
ChartView
Asked by
Don
Top achievements
Rank 1
Answers by
Ves
Telerik team
Don
Top achievements
Rank 1
Share this question
or