SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


Alright, so its a two-question sort of day.

I’m running into an issue where I have several XyScatterRenderableSeries objects in the same plot, but I’m having difficulty varying their color. Here’s the style:

            <Style TargetType="scichart:XyScatterRenderableSeries">
                <Setter Property="PointMarker">
                        <scichart:EllipsePointMarker Width="9" Height="9"
                                                     Fill="{Binding SeriesColor}"

Now, I have a color picker in a custom legend and an implementation that, in the ViewModel, chooses the color for each individual series to ensure they are different (and to support gradients in certain scenarios).

The result is that all of the series items are rendered with the color of the LAST series, but, inspecting them with Snoop, they are bound correctly to different colors.

I’m guessing this is related to the voodoo you guys have to do to for the bitmap raster? Any ideas on how to approach it?


Edit: Image attached.

  • You must to post comments

Hi Dan,

Thanks for your enquiry. Ok it’s not a bug, but a ‘feature’ of the WPF style binding engine. What you are doing by adding an instance of an EllipsePointMarker to a style is creating one instance of EllipsePointMarker (which is a FrameworkElement) and sharing across two Scatter Series. This binds to its parent SeriesColor and as a result, you see that the points only have the last series color.

What you need to do instead is use the PointMarkerTemplate property of RenderableSeries. We have an example here:


Scroll down to this part

Templating RenderableSeries with PointMarkers

If you need to style or template a chart, then you can template the PointMarkers. This is useful where you want to share one declaration of a Point Marker over multiple (or unknown number) of Renderable Series and apply a shared WPF style to each one.

As BasePointMarker types are FrameworkElements you cannot share one BasePointMarker across multiple charts. If you want to do this (to minimise code typed) then you must set the BaseRenderableSeries.PointMarkerTemplate property instead.

<!-- Applies a PointMarker and SeriesColor via style -->
 <Style TargetType="s:BaseRenderableSeries">                               
     <Setter Property="SeriesColor" Value="White" />                               
     <Setter Property="PointMarkerTemplate">
             <!-- This is how we do PointMarkerTemplates in Scichart v2.0. You can either declare an EllipsePointMarker inline, -->
             <!-- or, if temmplating (because you are sharing a style across many series), then use a ControlTemplate with a BasePointMarker, -->
             <!-- or UIElement to replicate across each data-point -->
                 <s:EllipsePointMarker Fill="#FF00DC" Stroke="White" Width="7" Height="7"/>

This technique is also used and tested by the Series Selection example.

Hope this helps!


  • dsantimore
    Ah yes, I think I understand -- and I understand that about WPF styles. But maybe you can help clear up my confusion regarding the difference between PointMarker and PointMarker template: In this post we decided that I needed to use the latter for binding to series color. Just hoping to reduce my need to keep asking you guys questions so you have time to write new features :)
  • Andrew Burnett-Thompson
    Hey Dan, thanks for your consideration! We do spend a significant part of our time on support, but hey, its part of the job. Plus without you guys we wouldn't have a business, so, we love to help :-) Ok -> PointMarker is used if you want to set a PointMarker instance on a renderable series, e.g. 1 series 1 point marker. Consider that the PointMarkers are not UIElements on the screen but are working to do some drawing 'per point' internally. PointMarkerTEmplate is used if you want to set a PointMarker in a style, e.g. N series 1 point marker. What this does is duplicate the PointMarker you choose for each series. Its very similar to how WPF works, e.g. ItemsControl has Items (collection) which you may add to, or ItemsSource (binding) and ItemTemplate (creates view per binding item). Confusing at first, but we've tried to mirror traditional WPF as best as possible (considering we've thrown out the whole framework and written our own rendering engine that is!) Best regards, Andrew
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.