Pre loader

CursorModifier and ZoomPanModifier not work together

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
1
0

Hi,

I’m using SciChartGroup with SciChartSurface, each surface contains a set of modifiers, but when I add both CursorModifier and ZoomPanModifier at the same time, the ZoomPanModifier stops working.

<s:SciChartGroup ItemsSource="{Binding ChartPaneViewModels}">
    <s:SciChartGroup.ItemTemplate>
        <DataTemplate>
            <s:SciChartSurface SeriesSource="{Binding ChildPane.SeriesViewModels}">

                <s:SciChartSurface.ChartModifier>
                    <s:ModifierGroup>
                        <s:CursorModifier />
                        <!--<s:XAxisDragModifier/>
                        <s:MouseWheelZoomModifier/>
                        <s:RubberBandXyZoomModifier ExecuteOn="MouseRightButton" IsXAxisOnly="True"/>-->
                        <s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick"/>
                        <s:ZoomPanModifier ExecuteOn="MouseLeftButton" ClipModeX="None"/>
                    </s:ModifierGroup>
                </s:SciChartSurface.ChartModifier>
                        
                <s:SciChartSurface.XAxis>
                    <s:CategoryDateTimeAxis AxisAlignment="Bottom" VisibleRange="{Binding ChildPane.Range, Mode=TwoWay}"/>
                </s:SciChartSurface.XAxis>

                <s:SciChartSurface.YAxis>
                    <s:NumericAxis AutoRange="Always" AxisAlignment="Right">
                        <s:NumericAxis.GrowBy>
                            <s:DoubleRange Max="0.1" Min="0.1"/>
                        </s:NumericAxis.GrowBy>
                    </s:NumericAxis>
                </s:SciChartSurface.YAxis>

            </s:SciChartSurface>
        </DataTemplate>
    </s:SciChartGroup.ItemTemplate>
</s:SciChartGroup>

Error reproduced on SciChart version 2.2 and 2.3, on version 1.x it worked fine.

  • You must to post comments
Best Answer
4
0

Hi there,

Please see our KB article on How to Add Mouse Interaction to SciChart, the section on ChartModifier Precedence and Handled mouse events.

ChartModifier Precedence (Handled Events)

ChartModifiers obey a precedence, rather like WPF RoutedEvents. If you have a number of modifiers in a SciChartSurface, then the first modifier that handles an event marks it as e.Handled. Subsequent modifiers will not receive the event.

For instance, consider the following code:


    
        
        
             
             
             
             
        
    

If you drag the chart, then the series will not be selected too, because the RubberBandXyZoomModiifer marks MouseUp as Handled. The SeriesSelectionModifier relies on MouseUp to select. If the event is handled then it will not select.

So far this is all intuitive and good. But what about this case?


    
        
        
             
             
             
             
        
    

Working around event handling with ReceiveHandledEvents

The solution to the above problem is to set ReceiveHandledEvents=True on a modifier. This way the modifier will receive all events, even those marked as handled. Try the following code for instance:


    
        
        
             
             
             
             
        
    

Be careful with this flag though as it could enable event handling where it should not occur.

  • esper
    Yes, it helped. Thanks.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.