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

Answered Closed
0
0

I am using SciChart to draw some graph on my application.
I use ZoomPanModifier to be able to zoom and drag the graph (with range limit).

<s:ZoomPanModifier ClipModeX="ClipAtExtents" XyDirection="XYDirection" ZoomExtentsY="True" ExecuteOn="MouseLeftButton" IsEnabled="True"/>

But the problem is when I drag to the edge of the graph, it will scale up automatically when I keep dragging.

Is there any way so that I can zoom in/out, drag graph (after zooming in), and no dragging and scaling up when I get to the edge of graph?

  • You must to post comments
Best Answer
0
0

I tested this just now and ZoomPanModifier.ClipModeX=ClipAtExtents did exactly what you are asking for.

Using SciChart v4.0.4

Are you seeing something different?

  • hapham.sioux
    With ClipAtExtents, I cannot pan the graph out of the edge, but I still can stretch the graph out when I keep dragging. I want to disable it.
  • You must to post comments
0
0

I’m afraid I am unable to reproduce this issue. I have modified our Mouse-Drag to Pan Example to have ClipModeX=ClipAtExtents.

<UserControl x:Class="SciChart.Examples.Examples.ZoomAndPanAChart.MouseDragToPan"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:ex="http://schemas.abtsoftware.co.uk/scichart/exampleExternals"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
             Loaded="MouseDragToPan_Loaded"
             d:DesignHeight="400"
             d:DesignWidth="600"
             mc:Ignorable="d">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/SciChart.Examples.ExternalDependencies;component/Resources/Styles/ToolbarButtonsCommon.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Border Background="#FF232426"
                BorderBrush="#323539"
                Panel.ZIndex="9999"
                BorderThickness="0,0,2,0">

            <WrapPanel HorizontalAlignment="Left"
                       Orientation="Vertical">

                <ex:FlyoutMenuButton x:Name="dragToPanModExample"
                                     HorizontalAlignment="Left"
                                     Padding="0"
                                     Content="Pan"
                                     Style="{StaticResource FlyoutMenuButtonStyle}"
                                     ToolTipService.ToolTip="Pan">

                    <ex:FlyoutMenuButton.PopupContent>
                        <StackPanel MinWidth="150" Orientation="Vertical">

                            <TextBlock Text="Pan SciChart on" />

                            <ComboBox x:Name="panSciChartOn"
                                      SelectedIndex="0"
                                      SelectionChanged="PanSciChartOn_OnSelectionChanged" />

                        </StackPanel>
                    </ex:FlyoutMenuButton.PopupContent>
                </ex:FlyoutMenuButton>

                <Button HorizontalAlignment="Left"
                        Command="{Binding ElementName=sciChart, Path=AnimateZoomExtentsCommand}"
                        Content="Zoom Extents"
                        Style="{StaticResource ZoomExtentsButtonStyle}"
                        ToolTipService.ToolTip="Zoom to Extents" />

            </WrapPanel>
        </Border>

        <s:SciChartSurface x:Name="sciChart" Grid.Column="1">

            <s:SciChartSurface.RenderableSeries>
                <s:FastMountainRenderableSeries Fill="#77279B27" Stroke="#FF177B17" />
                <s:FastMountainRenderableSeries Fill="#77FF1919" Stroke="#FFDD0909" />
                <s:FastMountainRenderableSeries Fill="#771964FF" Stroke="#FF0944CF" />
            </s:SciChartSurface.RenderableSeries>

            <s:SciChartSurface.XAxis>
                <s:NumericAxis GrowBy="0,0" />
            </s:SciChartSurface.XAxis>

            <s:SciChartSurface.YAxis>
                <s:NumericAxis GrowBy="0.1, 0.1" />
            </s:SciChartSurface.YAxis>

            <!--  Adding the ZoomPanModifier gives SciChart the ability to pan on mouse-drag  -->
            <s:SciChartSurface.ChartModifier>
                <s:ModifierGroup>                   
                    <s:ZoomPanModifier x:Name="zoomPanModifier"
                                       ClipModeX="ClipAtExtents"
                                       ExecuteOn="MouseLeftButton"
                                       IsEnabled="True" />
                    <s:MouseWheelZoomModifier/>
                    <s:ZoomExtentsModifier/>
                </s:ModifierGroup>
            </s:SciChartSurface.ChartModifier>

        </s:SciChartSurface>

    </Grid>

</UserControl>

Below you can see the behaviour. When I get to the extents of the data in X, there is no stretching.

enter image description here

Can you please provide a code sample to reproduce? Preferably by modifying the same example.

Best regards,
Andrew

  • hapham.sioux
    Sorry, it’s my mistake. I misunderstood about the graph behavior from my teammate. We got another problem. But I think I should post another question.
  • You must to post comments
Showing 2 results