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

0 votes

I need to do some calculation for data in visible range after zoom. Is there any notification when gesture ends in SCIPinchZoomModifier? If not, then that means I have to build a custom zoom gesture modifier? If so could you show me how pinch zoom is done in SCIPinchZoomModifier so that I don’t need to build everything from scratch? Thanks

  • Haoran Xie asked 6 months ago
  • last active 4 months ago
0 votes

Hi Team,

I added the PinchZoomModifier to my chart. However, when we do the gesture it does not zoom, instead, it pans the y-axis.
Here is the code:

<s:SciChartSurface s:ThemeManager.Theme="BrightSpark">
                    <s:VerticalSliceModifier ShowTooltipOn="Never">
                            <s:VerticalLineAnnotation Style="{StaticResource SliceStyle}" X1="{Binding SelectedStartDate, Mode=TwoWay}" IsEditable="True"/>
                            <s:VerticalLineAnnotation Style="{StaticResource SliceStyle}" X1="{Binding SelectedEndDate, Mode=TwoWay}" IsEditable="True"/>
                    <s:RubberBandXyZoomModifier ExecuteOn="MouseLeftButton"
                                                RubberBandFill="#AA34aeeb" RubberBandStroke="#AAFFFFFF"
                                                RubberBandStrokeDashArray="2 2"/>
                    <s:PinchZoomModifier XyDirection="XDirection"/>
                    <s:MouseWheelZoomModifier XyDirection="XDirection"/>
                    <s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick" />
                    <s:YAxisDragModifier DragMode="Pan"/>
                    <s:XAxisDragModifier DragMode="Pan" ClipModeX="None"/>
                <s:DateTimeAxis AxisTitle="Time" VisibleRange="{Binding XVisibleRange, Mode=TwoWay}"
                                TextFormatting="dd-MMM-yyyy" SubDayTextFormatting="HH:mm:ss" DrawMinorTicks="True" />
                <s:NumericAxis AxisTitle="Distance" VisibleRange="{Binding YVisibleRange, Mode=TwoWay}"/>
                <s:XyScatterRenderableSeries DataSeries="{Binding Chirps}" >
                        <s:EllipsePointMarker Width="9" Height="9" Fill="SteelBlue" Stroke="LightSteelBlue" StrokeThickness="2"/>

Can you please help me to know what’s wrong here?

1 vote

I am using a PinchZoomModifier with my chart and I would like to execute some code when the user stops the zooming action (stops touching the screen). Is it possible to do? Are there any listeners I could attach to the PinchZoomModifier? I couldn’t find any in the docs.

1 vote

If you set limit on range of axis, the pinch gesture will not work correctly.
Pinch the chart and hold for a while (about less than 1 sec), the chart will resize to the limit value you set on the axis.

You can change code of in Examples to below to reproduce this problem.

final IAxis xBottomAxis = sciChartBuilder.newNumericAxis()
                    .withAxisTitle("Time (ms)")
                    .withVisibleRange(new DoubleRange(2.5, 4.5))
                    .withVisibleRangeLimit(0,20)   // this will help reproduce the problem
Showing 4 results
This template supports the sidebar's widgets. Add one or use Full Width layout.