Pre loader

How can I Zooming my chart in real time

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
1

Hi all,
I developed my application in real time where i introduce my WPF in winforms
So i developed the class Graph.xaml.cs where i defined my function :
public void CreateDataSetAndSeries(List lstX, List lstY)
{
series0 = new XyDataSeries<DateTime, double>();
using (this.sciChartSurface.SuspendUpdates())
{
series0.Append(lstX, lstY);
}
lineSeries.DataSeries = series0;
sciChartSurface.ZoomExtentsY();
}

i don’t make the code of charting in the constructor also not in the function sciChartSurface_Loaded() because i must filling those list from the winforms frame after this i make the code for zooming in the Graph.xaml :

<SciChart:SciChartSurface.ChartModifier>

<SciChart:RubberBandXyZoomModifier/>

                <SciChart:ZoomPanModifier ExecuteOn="MouseRightButton"/>
                    <SciChart:ZoomExtentsModifier ExecuteOn="MouseDoubleClick"/>

                <SciChart:CursorModifier ReceiveHandledEvents="True" ShowAxisLabels="True"  ShowTooltip="True" ShowTooltipOn="MouseRightButtonDown"/>

But the problem i have the two cursor (like the picture) but i can’t did the zoom pan (also i put stop for my application to make a Zoom but i have the same problem ) !! i am blocked in this step someone can help me it’s urgent ! and Thank you !

Images
  • You must to post comments
1
0

Hi there,

I guess this could be caused by using AutoRange=Always mode in your application. Unfortunately you haven’t posted code with definition of axes so I’m not sure.
If this is your case then I would suggest to take on this articles from knowledge base :

Also I would suggest to take a look on similar threads from forums. Maybe they will be useful:

Hope it helps!

  • You must to post comments
0
0

Hi Yura,
This is my Xaml code and i change the AutoRange=”Always” to AutoRange=”Never” the problem of zoom is resolved but another problem has arised. In fact, my graph isn’t been refreshed in real time and that i must double click in the chart area to draw it!! have you any idea to did the zoom and drawing the graph normally without refresh it every once ??!!! Thank you !
<UserControl x:Class=”BeanGUI.SensorGraph2D”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″
xmlns:s=”http://schemas.abtsoftware.co.uk/scichart”

         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"           
         xmlns:SciChart="http://schemas.abtsoftware.co.uk/scichart" 
         mc:Ignorable="d"  
         Loaded="sciChartSurface_Loaded"
         d:DesignHeight="300" d:DesignWidth="826">



<Grid>


    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!-- Define the SciChartSurface -->
    <SciChart:SciChartSurface Grid.Row="2" x:Name="sciChartSurface" Padding="10,10,80,10" SciChart:ThemeManager.Theme="Oscilloscope" MouseUp="sciChartSurface_MouseUp" GotMouseCapture="sciChartSurface_GotMouseCapture" MouseDown="sciChartSurface_MouseDown">

        <!-- Create three RenderableSeries, which map 1:1 to the DataSeries created in code-behind -->
        <SciChart:SciChartSurface.RenderableSeries>
            <SciChart:FastLineRenderableSeries x:Name="lineSeries" SeriesColor="#FFFFA500"/>
            <SciChart:FastLineRenderableSeries x:Name="redLine" SeriesColor="#FFFF1919"/>

        </SciChart:SciChartSurface.RenderableSeries>

        <!-- Create an X Axis -->
        <SciChart:SciChartSurface.XAxis>
            <SciChart:DateTimeAxis x:Name="XAxis" AutoRange="Never"  TextFormatting="HH:mm MMM dd" SubDayTextFormatting="HH:mm:ss MMM dd"/>
        </SciChart:SciChartSurface.XAxis>

        <!-- Create a Y Axis -->
        <SciChart:SciChartSurface.YAxis>
            <SciChart:NumericAxis Name="YAxis" AutoRange="Never" DrawMinorTicks="True" DrawMinorGridLines="true" DrawLabels ="true" DrawMajorGridLines="true" TextFormatting="0.0000" >
                <SciChart:NumericAxis.GrowBy>
                    <SciChart:DoubleRange Min="0.1" Max="0.1"/>
                </SciChart:NumericAxis.GrowBy>
            </SciChart:NumericAxis>
        </SciChart:SciChartSurface.YAxis>
        <!--  Add some modifiers to zoom, zoom extents  -->
        <SciChart:SciChartSurface.ChartModifier>              
                <SciChart:ModifierGroup>
                <SciChart:XAxisDragModifier></SciChart:XAxisDragModifier>
                <SciChart:YAxisDragModifier AxisId="SecondaryAxisId"></SciChart:YAxisDragModifier>
                <SciChart:YAxisDragModifier AxisId="PrimaryAxisId"></SciChart:YAxisDragModifier>
                            <SciChart:LegendModifier ShowLegend="false" ShowVisibilityCheckboxes="False" Margin="3"/>
                            <SciChart:RubberBandXyZoomModifier/>

                <SciChart:ZoomPanModifier ExecuteOn="MouseRightButton"/>
                    <SciChart:ZoomExtentsModifier ExecuteOn="MouseDoubleClick"/>

                <SciChart:CursorModifier ReceiveHandledEvents="True" ShowAxisLabels="True"  ShowTooltip="True" ShowTooltipOn="MouseRightButtonDown"/>

                    <!-- For the circle Marks -->                     
           <!--    -->                       
            </SciChart:ModifierGroup>                        
        </SciChart:SciChartSurface.ChartModifier>          
    </SciChart:SciChartSurface>

    <!-- Define the Toolbar -->
    <StackPanel Grid.Row="0" Margin="2,4"  HorizontalAlignment="Left" Orientation="Horizontal">
        <Label x:Name="measureLabel1"  Margin="5"  Foreground="Green" FontStyle="Normal" FontSize="15" FontStretch="UltraCondensed"/>
        <Label x:Name="unit"  Margin="2"  Foreground="Green" FontStyle="Normal" FontSize="10" FontStretch="UltraCondensed"/>
    </StackPanel>

        <!-- Define the Toolbar verticale -->
    <StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Vertical" Width="80">
        <StackPanel.Background>
            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="Black" Offset="0" />
                <GradientStop Color="#FFCDFFDC" Offset="1" />
            </LinearGradientBrush>
        </StackPanel.Background>
        <!-- Update Theme -->
        <GroupBox Header="Theme" Height="86" Name="groupBox2" Width="68" BorderBrush="#FFE2E226" FontSize="11" ForceCursor="False">
            <!-- -->
            <Grid Height="62" Width="66">
                <Grid.RowDefinitions>
                    <RowDefinition Height="35*" />
                    <RowDefinition Height="29*" />
                </Grid.RowDefinitions>
                <ComboBox x:Name="cboTheme" MinWidth="50" Margin="2,16,12,26" SelectionChanged="cboThemeChanged" Grid.RowSpan="2" />
            </Grid>
            <GroupBox.Foreground>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FF449D92" Offset="1" />
                </LinearGradientBrush>
            </GroupBox.Foreground>
        </GroupBox>
        <GroupBox Header="Symboles" Height="95" Name="groupBox1" Width="70" BorderBrush="#FFE2E226">
            <GroupBox.Foreground>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FFFFFF31" Offset="1" />
                    <GradientStop Color="#FFF1F12E" Offset="0.948" />
                    <GradientStop Color="#FF09D1DD" Offset="0.919" />
                    <GradientStop Color="#FF07AEB8" Offset="0.767" />
                    <GradientStop Color="#FFC0EA52" Offset="0.942" />
                    <GradientStop Color="#FFF3F32E" Offset="0.959" />
                    <GradientStop Color="#FFC0EA52" Offset="0.942" />
                    <GradientStop Color="#FFF8F82F" Offset="0.977" />
                    <GradientStop Color="#FF60DC9A" Offset="0.93" />
                    <GradientStop Color="#FF116C6C" Offset="0.878" />
                </LinearGradientBrush>
            </GroupBox.Foreground>
            <Grid Height="39" Width="51">
                <RadioButton x:Name="rdioBtCircle" Content="Circle" BorderThickness="4" Margin="-4,-8,-20,0" Foreground="White" FontSize="10" FontStretch="UltraCondensed" Checked="rdioBtCircle_Checked"  Height="36" VerticalAlignment="Top"/>
                <RadioButton x:Name="rdioBtCarre" Content="Square" BorderThickness="4" Margin="-4,9,-21,6" Foreground="White" FontSize="10" FontStretch="UltraCondensed" />
                <RadioButton x:Name="rdioBtTriangle" Content="Triangle" BorderThickness="4" Margin="-4,6,-21,-20" Foreground="white" FontSize="10" FontStretch="UltraCondensed" Height="14"  />
                <RadioButton x:Name="rdioBtSans" Content="None" BorderThickness="4" Foreground="white" FontSize="10" FontStretch="UltraCondensed" Margin="-4,42,2,-15" />
            </Grid>
        </GroupBox>
        <Button Click="CopyToClipboardClick" Content="Copy to Clipboard" Height="30" />
        <Button Click="SaveAsPngClick" Content="Save to PNG" Height="30" />
        <Button Margin="3" Click="PrintToXpsClick" Content="Print" Height="30" Width="75" />
    </StackPanel>

    <Label x:Name="graphPaneTitle"  Margin="5" HorizontalAlignment="Center"  Foreground="Black" FontStyle="Italic" FontSize="18" FontStretch="UltraCondensed"/>
</Grid>

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies