SciChart WPF 2D Charts > ChartModifier API > Selection > Series Selection
Series Selection

SciChart features ChartModifierBase derived classes out of the box which allow Series Selection and Data-point Selection. You can also create your own custom modifiers to do almost anything with SciChart. To hear more about our in-built selection modifiers, read on.

Each BaseRenderableSeries has an IsSelected property. When set to True, two things happen:

  1. The Series Z-order is modified, any selected series are drawn last (highest Z-order)
  2. BaseRenderableSeries.SelectedSeriesStyle is applied to the series.

Styling the Selected Series

To set a SelectedSeriesStyle on a renderable-series, use the following XAML:

Styling the Selected Series
Copy Code
<s:FastLineRenderableSeries>
   <s:FastLineRenderableSeries.SelectedSeriesStyle>
      <!-- When a series is selected, apply this style -->
      <!-- Changes Stroke to white on click -->
      <!-- Applies a PointMarker -->
      <Style TargetType="s:FastLineRenderableSeries">
         <Setter Property="Stroke" Value="White" />
         <Setter Property="PointMarkerTemplate">
            <Setter.Value>
               <ControlTemplate>
                  <s:EllipsePointMarker Fill="#FF00DC" Stroke="White"
                                        Width="7" Height="7"/>
               </ControlTemplate>
            </Setter.Value>
         </Setter>
      </Style>
   </s:FastLineRenderableSeries.SelectedSeriesStyle>
</s:FastLineRenderableSeries>

Now, whenever the IsSelected property is set on this RenderableSeries, then the SelectedSeriesStyle above will be applied, in this case, changing its Stroke and applying a PointMarker.

Using the SeriesSelectionModifier

The SeriesSelectionModifier combines both mouse-click to select behaviour and a unified SeriesSelectionModifier.SelectedSeriesStyle (to apply to all series in case of selection).

Using the SeriesSelectionModifier
Copy Code
<s:SeriesSelectionModifier>
    <s:SeriesSelectionModifier.SelectedSeriesStyle>
        <!-- This style will be applied to all RenderableSeries -->
        <Style TargetType="s:BaseRenderableSeries">
            <Setter Property="Stroke" Value="White" />
        </Style>
    </s:SeriesSelectionModifier.SelectedSeriesStyle>
</s:SeriesSelectionModifier>

NOTE:that SelectedSeriesStyle from modifier has lower priority than its counterpart from the RenderableSeries, so any style explicitly set on the RenderableSeries will override the one from modifier.

This will result in the following visual appearance when a series is selected:

 

See Also