Knowledgebase: RenderableSeries API
PointMarker Color Bindings
Posted by Admin - on 21 March 2014 11:19 AM

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

<s:XyScatterRenderableSeries DataSeries="{Binding DurationSeries[0]}" SeriesColor="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=SeriesColor}" 
                    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 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 PointMarkerTemplate property instead.

<!-- Applies a PointMarker and SeriesColor via style -->
<Style TargetType="s:BaseRenderableSeries">                                
    <Setter Property="SeriesColor" 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 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 -->
            <ControlTemplate>
                <s:EllipsePointMarker Fill="#FF00DC" Stroke="White" Width="7" Height="7"/>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
(1 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