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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

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.