Pre loader

Zooming 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

-1
0

Hello,
i want to do the same Zoom of this application(like the picture ) but in my application i don’t use the MVVM ! i think that the problem is in this step :
public ActionCommand SetRubberBandZoomModifierCommand { get { return new ActionCommand(() => SetModifier(ModifierType.RubberBandZoom)); } }
i haven’t the ModifierType in my application so how can i replace it in my Scichart ! and thank you!

Images
  • You must to post comments
0
0

Hi Andrew,
okay! I developed an application like the same application “Oscilloscope” but without using the Mvvm(just drawing a curve in real time) so my purpose in to make the Zoom in this curve , but my problem is : When i make a zoom in my graph , the zoom will be instantaneous and the curve return without zoom, i want did the same Zoom like the application Oscilloscope (zoming and continue to draw the graph with zoom in real time) i hope you are understand me ? thank you !

<UserControl.Resources>

    <Style TargetType="SciChart:SciChartScrollbar">
    <Setter Property="GripsThickness" Value="10"/>

    <!-- Define style for resizing grips -->
    <Setter Property="GripsStyle">
        <Setter.Value>
            <Style TargetType="Control">
                <Setter Property="VerticalAlignment" Value="Bottom"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Control">
                            <Border BorderThickness="2,2,2,2" CornerRadius="2" BorderBrush="Black" Background="#A90F0F" Height="15">
                                <Line Stroke="Black" X1="0" Y1="0" X2="0" Y2="1" Stretch="Fill" StrokeThickness="2"/>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Setter.Value>
    </Setter>

    <!-- Define style for viewport area -->
    <Setter Property="ViewportStyle">
        <Setter.Value>
            <Style TargetType="Control">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Control">
                            <Border BorderThickness="0,1,0,1" BorderBrush="Black" Background="#99000000"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Setter.Value>
    </Setter>

    <!-- Define style for non selected area -->
    <Setter Property="NonSelectedAreaStyle">
        <Setter.Value>
            <Style TargetType="Path">
                <Setter Property="Fill" Value="#33000000"/>
            </Style>
        </Setter.Value>
    </Setter>
</Style>

</UserControl.Resources>

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

    <!-- Define the SciChartSurface -->
    <SciChart:SciChartSurface Grid.Row="3" x:Name="sciChartSurface" Padding="10,10,80,10" SciChart:ThemeManager.Theme="Oscilloscope" RenderPriority="Low" >

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

        </SciChart:SciChartSurface.RenderableSeries>

        <!-- Create an X Axis -->
        <SciChart:SciChartSurface.XAxis>
            <SciChart:DateTimeAxis  Name="XAxis" AutoRange="Never" DrawMinorTicks="true" DrawMinorGridLines="True"   DrawLabels ="true" DrawMajorGridLines="true" MinHeight="50"  TextFormatting="HH:mm MMM dd"
                                  SubDayTextFormatting="HH:mm:ss MMM dd yyyy">
                <SciChart:DateTimeAxis.GrowBy>
                    <SciChart:DoubleRange Min="0" Max="0"/>
                </SciChart:DateTimeAxis.GrowBy>
                <SciChart:DateTimeAxis.Scrollbar>
                    <SciChart:SciChartScrollbar Height="16"/>
                </SciChart:DateTimeAxis.Scrollbar>

            </SciChart:DateTimeAxis  >
        </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.Scrollbar>
                    <SciChart:SciChartScrollbar Width="16"/>
                </SciChart:NumericAxis.Scrollbar>

            </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:ZoomExtentsModifier ExecuteOn="MouseDoubleClick"/>
                <SciChart:ZoomPanModifier ExecuteOn="MouseRightButton" ZoomExtentsY="True" />

                <SciChart:CursorModifier ReceiveHandledEvents="True" ShowAxisLabels="True" ShowTooltip="True" ShowTooltipOn="MouseRightButtonDown"/>
                <SciChart:RubberBandXyZoomModifier x:Name="rubberBandZoomModifier" IsEnabled="{Binding ChartModifier, Mode=TwoWay, ConverterParameter=RubberBandZoom}" IsXAxisOnly="False"/>
                <SciChart:MouseWheelZoomModifier/>
                <!-- For the point values -->

                <SciChart:SeriesSelectionModifier SelectionChanged="SeriesSelectionModifier_SelectionChanged">
                    <SciChart:SeriesSelectionModifier.SelectedSeriesStyle>
                        <Style TargetType="SciChart:BaseRenderableSeries">
                            <Setter Property="PointMarkerTemplate">
                                <Setter.Value>
                                    <ControlTemplate>
                                        <SciChart:EllipsePointMarker x:Name="PART_PointMarker" Stroke="White" Fill="#77777777" StrokeThickness="1" Width="5" Height="5"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </SciChart:SeriesSelectionModifier.SelectedSeriesStyle>
                </SciChart:SeriesSelectionModifier>

            </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"/>


    </StackPanel>
    <!-- Define the Toolbar verticale -->
    <StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Vertical" Width="81">
        <StackPanel.Background>
            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="Black" Offset="0" />
                <GradientStop Color="#FFCDFFDC" Offset="1" />
            </LinearGradientBrush>
        </StackPanel.Background>
        <GroupBox Header="Update THM" 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,7,18" SelectionChanged="cboThemeChanged" Grid.RowSpan="2" ForceCursor="True">
                    <ComboBox.Foreground>
                        <RadialGradientBrush>
                            <GradientStop Color="Black" Offset="0" />
                            <GradientStop Color="#FFC7A4A4" Offset="1" />
                        </RadialGradientBrush>
                    </ComboBox.Foreground>
                    <ComboBox.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="Black" Offset="0" />
                            <GradientStop Color="#FF52D477" Offset="1" />
                        </LinearGradientBrush>
                    </ComboBox.Background>
                </ComboBox>
            </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" Height="36" VerticalAlignment="Top" IsChecked="{Binding marker,ElementName=SeriesSelectionModifier_SelectionChanged}" Checked="rdioBtCircle_Checked_1" />
                <SciChart:SeriesSelectionModifier SelectionChanged="SeriesSelectionModifier_SelectionChanged">
                    <SciChart:SeriesSelectionModifier.SelectedSeriesStyle>
                        <Style TargetType="SciChart:BaseRenderableSeries">
                            <Setter Property="PointMarkerTemplate">
                                <Setter.Value>
                                    <ControlTemplate>
                                        <SciChart:EllipsePointMarker x:Name="PART_PointMarker" Stroke="White" Fill="#77777777" StrokeThickness="1" Width="5" Height="5"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </SciChart:SeriesSelectionModifier.SelectedSeriesStyle>
                </SciChart:SeriesSelectionModifier>


            </Grid>
        </GroupBox>

        <Button Click="ZoomExtendsClick" Content="Extends Zoom" Height="30" Foreground="#FFD8BCBC">
            <Button.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FFB8FFCD" Offset="1" />
                </LinearGradientBrush>
            </Button.Background>
        </Button>  

                <TextBlock Margin="3" Text="Zoom"/>
            </StackPanel>
        </ToggleButton>
    </StackPanel>

</Grid>

    • Guest
    • 9 years ago
    Hi Sahar, I'm not sure what can cause the issue, so could you please attach a complete code sample so we can look into? The surface definition looks alright, although the whole snippet seems to be mixed up a bit, maybe something got missed in it starting from the place where GroupBox appears.
  • You must to post comments
0
0

Hi Yuriy,
You can see my source code it’s a part from a big project, so i can explain some details : from the UserControl_SensorGraph2D.cs, i fill my series0 like this code : SensorG.CreateDataSetAndSeries(lstX_date_streaming, lstDataY_streaming); and into the SensorGrap2D.xaml.cs i make the definition
public void CreateDataSetAndSeries(List lstX, List lstY)
{

         series0 = new XyDataSeries<DateTime, double>(); 
        using (this.sciChartSurface.SuspendUpdates())
        {             
               series0.Append(lstX, lstY);                         
        }

        lineSeries.DataSeries = series0;


        sciChartSurface.ZoomExtents();
   }

it’s urgent for me to implement this step of Zoom ! And thank you!

Attachments
  • 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