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

0
0

Hi Andrew,

I have a problem with the Scrollbar : when i Choosed “ZoomX” after this i pressed the button ” Zoom” the Scrollbar run but the curve removed like “first” picture and “second”,
i think that the problem in the scrollbar because in my application the scrollbar moves from right to left and in your application like picture”Scichart” the Scrollbar moves from left to right !!
So how can i do this!
Thank you!

Best Regards,
Sahar.

C# Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using System.Timers;

using System.Windows.Threading;
using Abt.Controls.SciChart.Common;

using Abt.Controls.SciChart.Model.DataSeries;
using Abt.Controls.SciChart.Common.Helpers;
using Abt.Controls.SciChart;
using Common;
using System.Globalization;
using Microsoft.Win32;
using System.Diagnostics;
using Abt.Controls.SciChart.Visuals;
using System;
using System.Collections.Generic;
using System.Timers;
using Abt.Controls.SciChart.Model.DataSeries;
using Abt.Controls.SciChart.Numerics;
using Abt.Controls.SciChart.ChartModifiers;
using Abt.Controls.SciChart.Visuals.RenderableSeries;
using Abt.Controls.SciChart.Example.MVVM;
using Abt.Controls.SciChart.Example;
using Abt.Controls.SciChart.Visuals.Axes;
using Abt.Controls.SciChart.Example.Data;
using Abt.Controls.SciChart.Example.Common;
using Abt.Controls.SciChart.Example.Examples.IWantTo.AnnotateAChart.DragHorizontalThreshold;
using System.Collections.ObjectModel;
using System.Windows.Annotations;
using Abt.Controls.SciChart.Visuals.Annotations;


namespace BeanGUI
{
/// <summary>
/// Interaction logic for SensorGraph2D.xaml
/// </summary>
public partial class SensorGraph2D : UserControl, IExampleAware
{


    private IXyDataSeries<DateTime, double> series1;

    public double _Threshold;
    public Boolean chkBx_Threshold_checked = false;
    private bool _isMouseDoubleClick;
    private bool _isZoomEnabled;
    private bool _isPanEnabled;
    private TimedMethod _startDelegate;
    public Boolean Zoom_test = false;
    public int cpt = 0;
    private readonly Abt.Controls.SciChart.ActionCommand _zoomModeCommand;
    private I_BeanSensorModel sensor;

    private readonly Abt.Controls.SciChart.ActionCommand _panModeCommand;

    public double Measure_val;
    Boolean Circle = false;
    public string date_val;
    private IndexRange _xVisibleRange;
    public double val_Threshold;
    public int i = 0;
    public int h = 0;
    public double st;

    string[] Tab = new string[4];
    public SensorGraph2D()
    {
        InitializeComponent();
        _zoomModeCommand = new Abt.Controls.SciChart.ActionCommand(SetZoomMode);
        _panModeCommand = new Abt.Controls.SciChart.ActionCommand(SetPanMode);
        IsPanEnabled = true;


        /* for foreach all themeManager */


        foreach (string theme in ThemeManager.AllThemes)
        {
            cboTheme.Items.Add(theme);
        }
        cboTheme.SelectedItem = "Oscilloscope";


    }


    public ICommand ZoomModeCommand { get { return _zoomModeCommand; } }

    public ICommand PanModeCommand { get { return _panModeCommand; } }

    public bool IsZoomEnabled
    {
        get { return _isZoomEnabled; }
        set
        {
            _isZoomEnabled = value;

        }
    }
    public bool IsPanEnabled
    {
        get { return _isPanEnabled; }
        set
        {
            _isPanEnabled = value;

        }
    }

    private void SetPanMode()
    {
        IsPanEnabled = true;
        IsZoomEnabled = false;
    }

    private void SetZoomMode()
    {

        IsZoomEnabled = true;
    }


    public double Threshold
    {
        get { return _Threshold; }
        set
        {
            _Threshold = value;

        }
    }


    public IndexRange XVisibleRange
    {
        get { return _xVisibleRange; }
        set
        {
            if (Equals(_xVisibleRange, value))
                return;
            _xVisibleRange = value;
            OnPropertyChanged("XVisibleRange");

        }
    }

    private void OnPropertyChanged(string p)
    {
        throw new System.NotImplementedException();
    }

    public void CreateDataSetAndSeries_Alarm(List<DateTime> lstX1, List<double> lstY1)
    {
        series1 = new XyDataSeries<DateTime, double>();

        using (this.sciChartSurface.SuspendUpdates())
        {

            series1.Append(lstX1, lstY1);

        }
        redLine.DataSeries = series1;
        if (Zoom_test == false)
        {
            sciChartSurface.ZoomExtentsY();
        }

    }


    public double maxValuesY()
    {
        return (double)series0.YMax;
    }

    public double minValuesY()
    {
        return (double)series0.YMin;
    }

    public DateTime maxValuesX()
    {
        return (DateTime)series0.XMax;
    }

    public DateTime minValuesX()
    {
        return (DateTime)series0.XMin;
    }


    public void ClearDataSeries1()
    {
        if (series1 == null)
            return;

        using (this.sciChartSurface.SuspendUpdates())
        {
            series1.Clear();
        }
    }



    /* for the Theme Changed*/
    private void cboThemeChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
    {

        ThemeManager.SetTheme(sciChartSurface, (string)cboTheme.SelectedItem);
        ThemeManager.SetTheme(sciChartSurface, (string)cboTheme.SelectedItem);

    }

    /*Point values*/
    public void SeriesSelectionModifier_SelectionChanged(object sender, EventArgs e)
    {
        if (Circle == true)
        {
            OnSeriesSelectionChanged();
        }
    }
    public void OnSeriesSelectionChanged()
    {
        bool hasSelection = sciChartSurface.SelectedRenderableSeries.Any();

    }


    private void CopyToClipboardClick(object sender, RoutedEventArgs e)
    {

        var bmp = this.sciChartSurface.ExportToBitmapSource();
        Clipboard.SetImage(bmp);

        MessageBox.Show("Copied to Clipboard!");
    }

    private void SaveAsPngClick(object sender, RoutedEventArgs e)
    {
        var dialog = new SaveFileDialog();
        dialog.DefaultExt = "png";
        dialog.AddExtension = true;
        dialog.Filter = "Png Files|*.png";
        dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        if (dialog.ShowDialog() == true)
        {
            this.sciChartSurface.ExportToFile(dialog.FileName, ExportType.Png);
            Process.Start(dialog.FileName);
        }
    }


    private void ZoomExtendsClick(object sender, RoutedEventArgs e)
    {
        sciChartSurface.ZoomExtents();

        Zoom_test = false;
        this.panModifier.IsEnabled = false;
    }
    private void PrintToXpsClick(object sender, RoutedEventArgs e)
    {
        var dialog = new PrintDialog();
        if (dialog.ShowDialog() == true)
        {
            var size = new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaWidth * 3 / 4);

            var scs = CreateSciChartSurfaceWithoutShowingIt(size);


            Action printAction = () => dialog.PrintVisual(scs, "Programmer Awesomeness");
            Dispatcher.BeginInvoke(printAction);
        }
    }

    private void ZoomExtentsY_Checked(object sender, RoutedEventArgs e)
    {
        this.XAxis.AutoRange = AutoRange.Always;
        this.YAxis.AutoRange = AutoRange.Never;
        if (rubberBandZoomModifier != null)
        {

            var checkBox = (CheckBox)sender;
            rubberBandZoomModifier.ZoomExtentsY = checkBox.IsChecked == true;
        }
    }
    private void ZoomExtentsX_Checked(object sender, RoutedEventArgs e)
    {

        this.YAxis.AutoRange = AutoRange.Always;
        this.XAxis.AutoRange = AutoRange.Never;
        if (rubberBandZoomModifier != null)
        {
            var checkBox = (CheckBox)sender;
            rubberBandZoomModifier.IsXAxisOnly = checkBox.IsChecked == true;
        }
    }

    private void ZoomClick(object sender, RoutedEventArgs e)
    {

        Zoom_test = true;


    }

    private void ZoomPanModifier_MouseDown(object sender, MouseButtonEventArgs e)
    {
        this.XAxis.AutoRange = AutoRange.Never;
        this.YAxis.AutoRange = AutoRange.Never;
    }

    private void UserControl_Loaded(object sender, RoutedEventArgs e)
    {

    }

    public void OnExampleExit()
    {
        throw new System.NotImplementedException();

    }

    public void OnExampleEnter()
    {
        throw new System.NotImplementedException();
    }
    public void CursorModifier_MouseDown(object sender, MouseButtonEventArgs e)
    {

        this.XAxis.Scrollbar.IsEnabled = false;
        System.Diagnostics.Debug.WriteLine("Sahar====>");
    }


    private void chkBx_Threshold_Checked(object sender, RoutedEventArgs e)
    {
        chkBx_Threshold_checked = true;
    }

    private void chkBx_Threshold_Unchecked(object sender, RoutedEventArgs e)
    {
        chkBx_Threshold_checked = false;

        ClearDataSeries1();
    }




}
}

XAML CODE

<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:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:SciChart="http://schemas.abtsoftware.co.uk/scichart" 
         xmlns:helpers="clr-namespace:Abt.Controls.SciChart.Example.Helpers;assembly=Abt.Controls.SciChart.Example"
          xmlns:Common="clr-namespace:Abt.Controls.SciChart.Example.Common;assembly=Abt.Controls.SciChart.Example"
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300" Loaded="UserControl_Loaded">


<UserControl.Resources>

</UserControl.Resources>

<Grid x:Name="LayoutRoot">
    <Grid.Resources>
        <Common:DoubleToGridLengthConverter x:Key="DoubleToGridLengthConverter"/>
    </Grid.Resources>



    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <SciChart:SciStockChart x:Name="sciChartSurface" Grid.Row="1" Padding="20,40,10,10" IsPanEnabled="{Binding IsPanEnabled}" IsRubberBandZoomEnabled="{Binding IsZoomEnabled}" SciChart:ThemeManager.Theme="Oscilloscope"  >

        <!-- <SciChart:SciStockChart.Annotations>
            <SciChart:HorizontalLineAnnotation HorizontalAlignment="Stretch"
            IsEditable="True"
            LabelPlacement="Axis"
            LabelTextFormatting="0.00"
            ShowLabel="True"
            Stroke="Red"
            StrokeThickness="2"
            Y1="{Binding Threshold,Mode=TwoWay}"  />
        </SciChart:SciStockChart.Annotations> -->



        <!-- 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:SciChartSurface.RenderableSeries>


        <SciChart:SciStockChart.XAxisStyle>
            <Style TargetType="SciChart:CategoryDateTimeAxis">
                <Setter Property="VisibleRange" Value="{Binding XVisibleRange, Mode=TwoWay}"/>
            </Style>
        </SciChart:SciStockChart.XAxisStyle>
        <SciChart:SciStockChart.XAxis>
            <SciChart:DateTimeAxis  Name="XAxis"  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  >
        </SciChart:SciStockChart.XAxis>

        <!-- Create a Y Axis -->
        <SciChart:SciStockChart.YAxis>
            <SciChart:NumericAxis Name="YAxis" AutoRange="Never" AllowDrop="False" ToolTip="true"
                                  DrawMinorTicks="True" DrawMinorGridLines="true" DrawLabels ="true" DrawMajorBands="True" AutoTicks="True" DrawMajorGridLines="true" TextFormatting="0.0000" >

                <SciChart:NumericAxis.GrowBy>
                    <SciChart:DoubleRange Min="0.1" Max="0.1"/>
                </SciChart:NumericAxis.GrowBy>


            </SciChart:NumericAxis>
        </SciChart:SciStockChart.YAxis>

        <!--  Add some modifiers to zoom, zoom extents  -->

        <!--    -->
        <SciChart:SciStockChart.ChartModifier>

            <SciChart:ModifierGroup>


                <SciChart:RubberBandXyZoomModifier x:Name="rubberBandZoomModifier" IsEnabled="True" IsXAxisOnly="False" ZoomExtentsY="False"/>

                <SciChart:ZoomExtentsModifier ExecuteOn="MouseDoubleClick"/>
                <SciChart:ZoomPanModifier x:Name="panModifier"/>

                <SciChart:CursorModifier ReceiveHandledEvents="True" ShowAxisLabels="True" ShowTooltip="True" ShowTooltipOn="MouseRightButtonDown"  ToolTip="true"/>
                <!-- <SciChart:RubberBandXyZoomModifier 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:SciStockChart.ChartModifier>
    </SciChart:SciStockChart>

    <!-- Define the Toolbar -->
    <!-- Define the Toolbar verticale -->
    <!-- Update Theme -->
    <!--  This grid is used to space Overview Control so its width matches parent chart XAxis  -->

    <Grid Grid.Row="2">
        <!--  The grid is used to set paddings around the Overview, so that the size of the Overview matches the size of the XAxis on the parent chart  -->
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="20"/>
            <!--  Matches parent surface padding left  -->
            <ColumnDefinition Width="25*"/>
            <!--  Hosts overview control  -->
            <ColumnDefinition Width="0"/>
            <!--  Used to bind to parent surface YAxis  -->
            <ColumnDefinition Width="80"/>
            <!--  Matches parent surface padding right  -->
        </Grid.ColumnDefinitions>

        <helpers:ActualSizePropertyProxy x:Name="proxy" Element="{Binding ElementName=sciChartSurface, Path=YAxis}"/>
        <SciChart:SciChartOverview  Grid.Column="1" ParentSurface="{Binding ElementName=sciChartSurface,
                                                    Mode=OneWay}"
                                                            SciChart:ThemeManager.Theme="{Binding ElementName=cboTheme,
                                                           Path=SelectedItem}"
                            SelectedRange="{Binding XVisibleRange,
                                             Mode=TwoWay}" Focusable="True" />




    </Grid>



    <Grid Grid.Row="1" Margin="40,40,0,0" VerticalAlignment="Top">
        <Grid.Resources>
            <!-- Style for Stats -->
            <Style TargetType="TextBlock" x:Key="StatsStyle">
                <Setter Property="FontSize" Value="26"/>
                <Setter Property="Margin" Value="0"/>
                <Setter Property="FontWeight" Value="Normal"/>
                <Setter Property="Foreground" Value="#BBFC9C29"/>
                <Setter Property="FontFamily" Value="pack://application:,,,/Resources/Fonts/#Neuropol Regular"/>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="60"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="186*" />
        </Grid.ColumnDefinitions>
        <Label x:Name="measureLabel1"    Margin="-8,6,12,-2"  Foreground="GreenYellow" FontStyle="Normal" FontSize="11" FontStretch="UltraCondensed" Target="{Binding}" IsEnabled="True"/>
        <TextBlock Margin="5" FontSize="16" Foreground="#eee" Text="{Binding DataContext.Threshold, StringFormat='Threshold = {0:#0.00}', RelativeSource={RelativeSource AncestorType=SciChart:SciChartSurface}}"/>
    </Grid>
    <Grid Grid.Row="1" Margin="-4,102,0,119" VerticalAlignment="Center">
        <Grid.RowDefinitions>
            <RowDefinition Height="12*" />
            <RowDefinition Height="2*" />
        </Grid.RowDefinitions>
        <Grid.Resources>
            <!-- Style for Stats -->
            <Style TargetType="TextBlock" x:Key="StatsStyle">
                <Setter Property="FontSize" Value="26"/>
                <Setter Property="Margin" Value="0"/>
                <Setter Property="FontWeight" Value="Normal"/>
                <Setter Property="Foreground" Value="#BBFC9C29"/>
                <Setter Property="FontFamily" Value="pack://application:,,,/Resources/Fonts/#Neuropol Regular"/>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="290*" />
        </Grid.ColumnDefinitions>
        <Label x:Name="ActifLabel"   IsEnabled="true"   HorizontalAlignment="Left" Foreground="GreenYellow" FontStyle="Normal" FontSize="11" FontStretch="UltraCondensed" Target="{Binding}"  />

    </Grid>
    <Grid Grid.Row="1" Margin="-4,-56,0,56" VerticalAlignment="Bottom">
        <Grid.RowDefinitions>
            <RowDefinition Height="15*" />
            <RowDefinition Height="2*" />
        </Grid.RowDefinitions>
        <Grid.Resources>
            <!-- Style for Stats -->
            <Style TargetType="TextBlock" x:Key="StatsStyle">
                <Setter Property="FontSize" Value="26"/>
                <Setter Property="Margin" Value="0"/>
                <Setter Property="FontWeight" Value="Normal"/>
                <Setter Property="Foreground" Value="#BBFC9C29"/>
                <Setter Property="FontFamily" Value="pack://application:,,,/Resources/Fonts/#Neuropol Regular"/>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="290*" />
        </Grid.ColumnDefinitions>
        <Label x:Name="inactifLabel"   IsEnabled="true"   HorizontalAlignment="Left" Foreground="GreenYellow" FontStyle="Normal" FontSize="11" FontStretch="UltraCondensed" Target="{Binding}"  />

    </Grid>




    <Grid Grid.Row="1"  VerticalAlignment="top" HorizontalAlignment="Center" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.Resources>
            <!-- Style for Stats -->
            <Style TargetType="TextBlock" x:Key="StatsStyle">
                <Setter Property="FontSize" Value="26"/>
                <Setter Property="Margin" Value="0"/>
                <Setter Property="FontWeight" Value="Normal"/>
                <Setter Property="FontFamily" Value="pack://application:,,,/Resources/Fonts/#Neuropol Regular"/>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="150"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="200*" />
        </Grid.ColumnDefinitions>
        <Label x:Name="graphPaneTitle" Margin="2" Foreground="#FFFFA500" FontStyle="Italic" FontSize="20" FontStretch="UltraCondensed" Height="31" />

    </Grid>

    <StackPanel Grid.Row="0" Orientation="Horizontal" >
        <!-- <Label x:Name="measureLabel1"    Margin="2"  Foreground="GreenYellow" FontStyle="Normal" FontSize="11" FontStretch="UltraCondensed" Height="25" Target="{Binding}" IsEnabled="True"/> -->
        <ComboBox x:Name="cboTheme" ToolTip="Update Theme" Margin="2,3,2,0" SelectionChanged="cboThemeChanged" Foreground="GreenYellow" HorizontalAlignment="center" SelectedItem="Oscilloscope"  Height="28" Width="92">
            <ComboBox.Background>

                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FF979D99" Offset="1" />
                </LinearGradientBrush>

            </ComboBox.Background>
        </ComboBox>
        <Line Margin="2,3,2,0" Stroke="Gray" Y2="25"/>
        <Button Click="PrintToXpsClick" ToolTip="Print Graph"  Foreground="GreenYellow"  Margin="2,3,2,0"  Content="Print"  Height="28" >

            <Button.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FFB3CBBB" Offset="1" />
                </LinearGradientBrush>
            </Button.Background>
        </Button>



        <Button Click="SaveAsPngClick" ToolTip="Save To PNG" Foreground="GreenYellow"  Margin="2,3,2,0"  Content="Save to PNG" Height="28" >
            <Button.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FF979D99" Offset="1" />
                </LinearGradientBrush>
            </Button.Background>
        </Button>
        <Button Click="CopyToClipboardClick" ToolTip="Copy To ClipBoard" Foreground="GreenYellow"  Margin="2,3,2,0"  Content="Copy to Clipboard" Height="28">
            <Button.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FF979D99" Offset="1" />
                </LinearGradientBrush>
            </Button.Background>
        </Button>
        <Line Margin="2,3,2,0" Stroke="Gray" Y2="25"/>

        <ToggleButton Click="ZoomExtendsClick" ToolTip="Extends Zoom" Margin="2,3,2,0"  Foreground="GreenYellow" Height="28" >
            <StackPanel Orientation="Horizontal">
                <Image Margin="3" Source="/Abt.Controls.SciChart.Example;component/Resources/Images/fit_to_size.png" Stretch="None"/>
                <TextBlock Margin="3" Text="Extends Zoom"/>

            </StackPanel>

            <ToggleButton.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FF979D99" Offset="1" />
                </LinearGradientBrush>
            </ToggleButton.Background>
        </ToggleButton>



        <ToggleButton Click="ZoomClick" ToolTip="Zoom Curves" Margin="2,3,2,0"  Foreground="GreenYellow" Height="28" >
            <StackPanel Orientation="Horizontal">
                <Image Margin="3" Source="/Abt.Controls.SciChart.Example;component/Resources/Images/zoom.png" Stretch="None"/>
                <TextBlock Margin="3" Text="Zoom"/>

            </StackPanel>
            <ToggleButton.Background>
                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FF979D99" Offset="1" />
                </LinearGradientBrush>
            </ToggleButton.Background>
        </ToggleButton>
        <ToggleButton x:Name="btnPan" ToolTip="Pan"
                      Margin="2,3,2,0"  Foreground="GreenYellow" Height="28"
                      Content="Pan"

                      IsChecked="{Binding IsEnabled,ElementName=panModifier,
                                          Mode=TwoWay}"
                      SciChart:ToggleButtonExtensions.GroupName="ModifiersGroup">

            <ToggleButton.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FF979D99" Offset="1" />
                </LinearGradientBrush>
            </ToggleButton.Background>
        </ToggleButton>
        <CheckBox  Margin="2,3,2,0" Checked="ZoomExtentsY_Checked" Content="ZoomY" Foreground="GreenYellow" Unchecked="ZoomExtentsY_Checked" Height="14" >

        </CheckBox>
        <CheckBox  Margin="2,3,2,0" Checked="ZoomExtentsX_Checked" Foreground="GreenYellow" Content="ZoomX" Unchecked="ZoomExtentsX_Checked" Height="14">
        </CheckBox>
        <Line Margin="2,3,0,0" Stroke="Gray" Y2="25"/>
        <CheckBox  Margin="2,3,2,0" Name="chkBx_Threshold" Checked="chkBx_Threshold_Checked" Foreground="GreenYellow" Content="Alarm" Unchecked="chkBx_Threshold_Unchecked" Height="14">
        </CheckBox>

        <StackPanel.Background>
            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="Black" Offset="0" />
                <GradientStop Color="Black" Offset="1" />
            </LinearGradientBrush>
        </StackPanel.Background>





    </StackPanel>


    <!-- Define the SciChartSurface -->


    <!-- Create an X Axis -->



</Grid>
</UserControl>
Images
  • You must to post comments
0
0

Hi Sahar, so the problem is the scrollbar is going the wrong direction?

You are updating your VisibleRange, right? The Scrollbar reacts to VisibleRange like this.

  • Scrollbar Extents Minimum = AxisBase.DataRange.Min Scrollbar
  • Scrollbar Extents Maximum = AxisBase.DataRange.Max
  • Scrollbar Grip Minimum = AxisBase.VisibleRange.Min
  • Scrollbar Grip Maximum = AxisBase.VisibleRange.Min

Is this not what is happening?

Try logging (Debug.WriteLine) the values of AxisBase.DataRange, AxisBase.VisibleRange when the chart is redrawn. It might reveal why the scrollbar is working in this way.

Best regards,
Andrew

Images
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.