Knowledgebase
PointMarker Color Bindings
Posted by Admin - on 12 February 2019 04:23 PM

New to SciChart v2.0 and later, the new BasePointMarker derived types can be data-bound to the parent series’ Stroke. The DataContext for a point-marker is set to the parent RenderableSeries when the point-marker is assigned, so, to bind to Stroke we simply use this:

<s:XyScatterRenderableSeries DataSeries="{Binding DurationSeries[0]}" Stroke="Green">
    <s:XyScatterRenderableSeries.PointMarker>
        <!-- Note: PointMarker DataContext is the parent RenderableSeries. You can bind to SeriesColor here -->
        <s:EllipsePointMarker Width="9" Height="9" 
                    Fill="{Binding Path=Stroke}" 
                    Stroke="LightBlue" 
                    StrokeThickness="2"/>
    </s:XyScatterRenderableSeries.PointMarker>
</s:XyScatterRenderableSeries>

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 PointMarker over multiple (or unknown number) of RenderableSeries 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 PointMarkerTemplate property instead.

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

Further Reading

To learn more about Point Markers in SciChart please see our documentation:

Also there are several examples of Point Markers usage in our SciChart Examples Suite:

(2 vote(s))
Helpful
Not helpful

CONTACT US

Not sure where to start? Contact us, we are happy to help!


CONTACT US

SciChart Ltd, 16 Beaufort Court, Admirals Way, Docklands, London, E14 9XL. Email: Legal Company Number: 07430048, VAT Number: 101957725