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

Answered
3
0

The issue I’m dealing with is that after setting up the SeriesSelectionModifier, I require a double-click (and a very, very precise double click, at that) to select a series. Naturally, this is also competing with the ZoomExtents() call that is the normal effect of a doubleclick.

<!-- Chart -->
        <scichart:SciChartSurface Grid.Column="1" Grid.Row="1" x:Name="sciChartSurface"
                                  SeriesSource="{Binding SeriesList, Mode=OneWay}"
                                  ChartTitle="{Binding Title}"
                                  >

            <scichart:SciChartSurface.XAxis>
                <scichart:NumericAxis x:Name="AxisX" Id="AxisX" AxisTitle="{Binding XTitle}" AxisAlignment="Bottom" />
            </scichart:SciChartSurface.XAxis>

            <scichart:SciChartSurface.YAxes>
                <scichart:NumericAxis x:Name="AxisY1" Id="AxisY1" AxisTitle="{Binding Y1Title}" AxisAlignment="Left"
                                      />
                <scichart:NumericAxis x:Name="AxisY2" Id="AxisY2" AxisTitle="{Binding Y2Title}" AxisAlignment="Right"
                                      IsEnabled="{Binding ShowY2Axis}"
                                      Visibility="{Binding RelativeSource={RelativeSource Self},
                                                           Path=IsEnabled,
                                                           Converter={StaticResource convBooleanToVisibility}}"
                                      />
            </scichart:SciChartSurface.YAxes>

            <!-- Modifiers -->
            <scichart:SciChartSurface.ChartModifier>

                <scichart:ModifierGroup>

                    <!-- TODO: Comment -->
                    <scichart:ZoomPanModifier ExecuteOn="MouseRightButton" />

                    <!-- TODO: Comment -->
                    <scichart:RubberBandXyZoomModifier IsEnabled="True" x:Name="rubberBandZoomModifier" IsXAxisOnly="False" ZoomExtentsY="False" IsAnimated="True"/>

                    <!-- TODO: Comment -->
                    <!--<scichart:RolloverModifier x:Name="rolloverModifier" DrawVerticalLine="False" UseInterpolation="True"  SourceMode="AllSeries" />-->

                    <!-- TODO: Comment -->
                    <scichart:CursorModifier x:Name="cursorModifer" SourceMode="AllSeries" UseInterpolation="True"/>

                    <!-- TODO: Comment-->
                    <scichart:ZoomExtentsModifier />

                    <!-- Exposes a LegendData property (of type ChartDataObject) which can be accesed via elementName from another control -->
                    <!-- ChartDataObject exposes a list of SeriesInfo -->
                    <scichart:LegendModifier x:Name="legend" GetLegendDataFor="AllSeries"/>
                    
                    <!-- Provides selection of series and custom styling options (to the selected series) -->
                    <scichart:SeriesSelectionModifier SelectedSeriesStyle="{StaticResource selectedSeriesStyle}" ExecuteOn="MouseLeftButton"
                                                      />
                    
                </scichart:ModifierGroup>
            </scichart:SciChartSurface.ChartModifier>

        </scichart:SciChartSurface>
  • You must to post comments
Best Answer
3
0

An update for you, in SciChart v3.0, the SeriesSelectionModifier has now been reconfigured to trigger on MouseUp. The RubberBandXyZoomModifier sets e.Handled on MouseUp when a successful zoom occurs.

So, putting RubberBandXyZoomModifier before the SeriesSelectionModifier in a ModifierGroup means handled zooms will not cause a series to be selected. his is now demonstrated in our Series Selection Example, which has both RubberBandXyZoomModifier and SeriesSelectionModifier.

<!-- Declare ChartModifiers -->
<s:SciChartSurface.ChartModifier>
    <s:ModifierGroup>

        <!-- Provides Interactivity -->
        <!-- NOTE: Order of Modifiers Matters because of e.Handled! -->
        <s:RubberBandXyZoomModifier/>
        
        <!-- Provides selection of series and custom styling to the selected series -->
        <s:SeriesSelectionModifier>                        
            <s:SeriesSelectionModifier.SelectedSeriesStyle>
                
                <!-- When a series is selected (on click), apply this style -->
                <!-- Changes SeriesColor to white on click -->
                <!-- Applies a PointMarker on click -->
                <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>
                
            </s:SeriesSelectionModifier.SelectedSeriesStyle>
        </s:SeriesSelectionModifier>                    
        
    </s:ModifierGroup>
</s:SciChartSurface.ChartModifier>

The RubberBandXyZoomModifier also does not start a zoom unless the user drags a few pixels, to prevent spurious handling of mouse events.

For more information about ChartModifiers and Modifier Precendence, see How to Add Mouse Interaction to SciChart.

Images
  • You must to post comments
2
0

Hi there,

Thanks for your enquiry! There is ChartModifierBase.ReceiveHandledEvents property, you should use it to prevent mouse events interfering. Also there is an option to set ExecuteOn property to change event which triggered execution. Or you can control modifiers via IsEnabled property, turning it on to particular one and off to others.

Hope this helps!

Best regards,
Yuriy

  • bochelie
    Hi Yuriy,One question. How can i use ChartModifierBase.ReceiveHandledEvents property to prevent mouse events interfering? I just dont get it.Regards
  • Yuriy
    Hi Bochelie,Chart modifiers work similarly to mouse event handlers in WPF and Silverlight. If a modifier further up the stack receives an event and handles it, then subsequent modifiers do not receive the event. This property overrides this behavior.Best regards, Yuriy
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.