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!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

V. 2.11.4972.38029:
Hello,

in my application I want to use a RubberBandXyZoomModifier and a CursorModifier simultaneously.

my Code:

                    <SciChart:LegendModifier x:Name="legend" GetLegendDataFor="AllSeries"/>
                    <SciChart:XAxisDragModifier/>
                    <SciChart:YAxisDragModifier/>
                    <SciChart:ZoomExtentsModifier ExecuteOn="MouseDoubleClick"/>
                    <SciChart:CursorModifier ShowTooltip="True" ShowAxisLabels="False" ShowTooltipOn="Always" TooltipLabelTemplate="{StaticResource ToolTipLabelTemplate}"/>
                    <SciChart:RubberBandXyZoomModifier x:Name="rubberBandZoomModifier" IsEnabled="True" IsXAxisOnly="False" ZoomExtentsY="False" IsAnimated="True" />
                    <SciChart:MouseWheelZoomModifier />

The zoom function works but there is no highlighter visible. If I remove the CursorModifier then it works great.

How can I resolve this?
Thanks!

  • You must to post comments
0
0

Hi,

Please, try to set ReceiveHandledEvents property to “True” for both modifiers, it should help. Feel free to post if any questions arise,

Best regards,
Yuriy

  • miri
    Hello,thank you for the fast response. It works perfectly.Best regards miri
  • You must to post comments
0
0

You can find out more information about how the ChartModifiers interact with one another at the KB article How to Add Mouse Interaction to SciChart.

Scroll down to the section titled

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:

<s:SciChartSurface>
    <s:SciChartSurface.ChartModifier>
        <!—Groups many ChartModifiers on a single chart with mouse-event
precedence -->
        <s:ModifierGroup>
             <!—Provides zoom on mouse-drag, handles MouseUp on successful
zoom-->
             <s:RubberBandXyZoomModifier/>
             <!—Selects Series on mouse-up -->
             <s:SeriesSelectionModifier/>
        </s:ModifierGroup>
    </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

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?

<s:SciChartSurface>
    <s:SciChartSurface.ChartModifier>
        <!—Groups many ChartModifiers on a single chart with mouse-event
precedence -->
        <s:ModifierGroup>
             <!—Provides pan on mouse-drag, handles MouseDown, MouseMove on
pan-->
             <s:ZoomPanModifier/>
             <!—Provides a cursor on mouse-move, requires MouseMove event
-->
             <s:CursorModifier/>
        </s:ModifierGroup>
    </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

Oh dear … Now if you mouse-drag the chart the cursor will not move with the mouse. Why is this occurring? Because the ZoomPanModiifer marks the MouseMove event as handled, the CursorModifier never receives it. This functionality is intended to prevent bad interactions between modifiers such as selection and zoom on click, but in this case it is hindering us.

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

Best regards,
Andrew

  • You must to post comments
0
0

I am experiencing this same “No animation” problem when using the RubberBandXyZoomModifier with your CustomRolloverModifier demoed here

Even if I set the RecieveHandledEvents property to True, the animation does not happen. I assume there is some handling code I need to add to the CustomRolloverModifier class from your demo. Any sugggestions would be greatly appreciated.

My ModifierGroup:

<s:ModifierGroup>

<s:RubberBandXyZoomModifier IsAnimated="True" IsXAxisOnly="True" ZoomExtentsY="True" ReceiveHandledEvents="True" ExecuteOn="MouseRightButton" />
   <fc:CustomRolloverModifier IsEnabled="True" BackgroundBrush="Black" Padding="3"  s:ClipToBoundsHelper.ClipToBounds="False" ReceiveHandledEvents="True"  />

 </s:ModifierGroup>
  • Andrew
    Hi Chris – what do you mean by ‘the animation doesn’t happen’? The zoom animation? Or the rollover updating its position during the animation? If the latter, then yes, the “Custom ChartModifiers – Part 1 – Creating a Custom Rollover Modifier” is intended to be a simple demo of our chartModifier API, not an exhaustive set of features. The real RolloverModifier which we ship with scichart handles overriding OnParentSurfaceRendered to update the rollover tooltip and position as the chart changes underneath it. This is something that the CustomRolloverModifier doesn’t do.
  • You must to post comments
0
0

Sorry Andrew, I meant to say what the Original Post stated: “The zoom function works but there is no highlighter visible”. Meaning, the green hightlight box when you drag to zoom does not show up. You can’t see the area you are trying to zoom in on. I can still drag and zoom just fine and the animation during the Zoom process works. I just need the little Green highlight box to show up as I’m dragging.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.