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!
- miri asked 11 years ago
- You must login to post comments
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
- Yuriy Zadereckiy answered 11 years ago
-
Hello, thank you for the fast response. It works perfectly. Best regards miri
- You must login to post comments
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
- Andrew Burnett-Thompson answered 10 years ago
- You must login to post comments
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>
- Chris Ludlow answered 7 years ago
-
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 login to post comments
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.
- Chris Ludlow answered 7 years ago
-
Oh, interesting. Well very likely that this code in CustomRolloverModifier is the culprit http://support.scichart.com/index.php?/Knowledgebase/Article/View/17235/32/custom-chartmodifiers—part-1—creating-a-custom-rollover-modifier // TODO: Using Clear will affect other modifiers so it is best to remove only those added by this modifier this.ModifierSurface.Clear(); As I said, this code is for demo purposes only (how to use our ChartModifierAPI), not intended for production use!
- You must login to post comments
Please login first to submit.