Pre loader

Tag: syncronising

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 vote
2k views

Hello,

I have several simple SciChartSurfaces in my WPF-grid. They are in the same WPF-column but in different WPF-rows, so they are arranged in a vertical manner.

I have noticed that the Y-Axis (a NumericAxis-objcet) moves automatically slightly to the left to make room for the numbers on the Y-Axis, if necessary.

I would like to ask if there is a way to “synchronize” the position of several similar Charts (or their Y-Axis´s, respectively.), so the different Y-Axis´s would always be in the same position. Ideally, the Y-Axis´s of all the Charts would move as far to the left as necessary to make room for the longest number of all the Axis´s.

I have attached an example of my current situation and the solution I would ideally like to achieve.

Is there any way to “connect” the different Axis of the charts to create the desired result?

Thank you.

0 votes
9k views

Good afternoon,

I wanted to synchronize the mouse events between graphs, but based on the value of the X axis, not on the position within the graph. In the photo attached below, it is seen that the mouse events are synchronized, and the rollover appears in both graphs. However, what I want is that if, for example, in the graph on the left, the mouse is at time 00: 15: 00.000, in the graph on the right, the rollover also appears at position X 00: 15: 00.000, regardless the width of each graph. Until now I have not been able to get it, as seen when on the left it is at the time 00: 22: 37.00 on the right it appears at the point 00: 10: 23.750.

I would need a way to achieve this with code behind, since I create the graphics programmatically and without MVVM.

As extra information, all charts have the same range of X axis values (they all go from the same start time to the same end time)

Thanks a lot!

1 vote
9k views

Hello,

I am currently taking a v5 test drive and noticed the following problem that would be a show stopper for me:

When syncing several chats via shared mouse events and shared visible x-Axis range I noticed that when zooming in that the chart axes get out of sync, sometimes significantly by several seconds on a CategoryDateTimeAxis, DateTimeAxis, but also apparently on numeric axes.

The error can easily be replicated when looking at your Example Suite , specifically the “Sync Multi Chart Mouse” sample. When you zoom into the chart you notice that the x-Axes on each chart are not aligned anymore. In this specific example when zooming in so that the minimum on the left side of the screen lies at around value 10 and the maximum at around 55 then moving with the mouse on the top chart to 52.44 shows a value of 52.53 on the lower chart. That is completely out of sync and gets worse on DateTime and Category DateTime axes.

Could anyone (and support) please chime in so I can understand what is going on and whether there is a fix for this or whether this is a bug that has been around for some time and cannot be adjusted within a reasonable amount of time?

I have been pulling my hairs over this and spent hours on different approaches, via ViewPortManager and the updating of shared visible range in both code and xaml. All to no avail and given the example code also exhibits the same issue I doubt it relates to a wrong implementation on my end.

Thanks a lot,
Matt W.

  • bbmat asked 6 years ago
  • last active 6 years ago
0 votes
9k views

I am have a vertical stacked chart setup which shares the same x- axis ranges. I am trying to find a way to add vertical lines in both the charts at once and further I need the vertical lines to be dragged in sync. When one vertical line annotation is dragged, I need the same movement to happen in the other chart as well. I can share a prototype if you want. Please suggest a solution.

0 votes
16k views

I deleted my prior question and instead provide code that reproduces the error. I just whipped up two SciChartSurfaces in xaml and bind to properties provided in code behind. Can you please take a look and see whether you also can RubberBandXyZoom but not correctly use ZoomPan? ZoomPan is not synced between the two charts. Its been a very frustrating couple hours….without finding the bug.

public partial class TestControl : UserControl
{
    private ILabelProvider _xAxisFormat;
    private string yAxisFormat;
    private ObservableCollection<IChartSeriesViewModel> _series1;
    private ObservableCollection<IChartSeriesViewModel> _series2;
    private DateRange _sharedXRange;

    public TestControl()
    {
        //SciChartSurface.SetLicenseKey(
        //    @"
        //    <LicenseContract>
        //      ....License Code goes here
        //    </LicenseContract>

        //    ");

        XAxisFormat = new DateTimeLabelProvider();
        YAxisFormat = "0.00";

        Series1 = new ObservableCollection<IChartSeriesViewModel>(new List<IChartSeriesViewModel>() { GenerateSampleLineSeries() });
        Series2 = new ObservableCollection<IChartSeriesViewModel>(new List<IChartSeriesViewModel>() { GenerateSampleLineSeries() });

        //set shared xRange
        SharedXRange = new DateRange((DateTime) Series1.First().DataSeries.XMin, (DateTime) Series1.First().DataSeries.XMax);

        InitializeComponent();
    }

    public ObservableCollection<IChartSeriesViewModel> Series1
    {
        get { return _series1; }
        set
        {
            _series1 = value;
        }
    }

    public ObservableCollection<IChartSeriesViewModel> Series2
    {
        get { return _series2; }
        set
        {
            _series2 = value;
        }
    }

    public DateRange SharedXRange
    {
        get { return _sharedXRange; }
        set
        {
            _sharedXRange = value;
        }
    }

    public ILabelProvider XAxisFormat
    {
        get { return _xAxisFormat; }
        set
        {
            _xAxisFormat = value;
        }
    }

    public string YAxisFormat
    {
        get { return yAxisFormat; }
        set
        {
            yAxisFormat = value;
        }
    }

    private IChartSeriesViewModel GenerateSampleLineSeries()
    {
        var seriesName = "TestLineSeries" + (new Random((int)DateTime.Now.Ticks)).Next();
        List<DateTime> timeStamps = new List<DateTime>();
        List<double> values = new List<double>();
        Random rand = new Random((int)DateTime.Now.Ticks);
        DateTime currentDt = DateTime.Now;
        double currentValue = 0;

        for (int index = 0; index < 1000; index++)
        {
            currentDt = currentDt.AddMinutes(1);
            currentValue = currentValue + (rand.NextDouble() - 0.5);

            timeStamps.Add(currentDt);
            values.Add(currentValue);
        }

        var dataSeries = new XyDataSeries<DateTime, double>();
        dataSeries.SeriesName = seriesName;
        dataSeries.Append(timeStamps, values);


        var renderSeries = new FastLineRenderableSeries() { Name = dataSeries.SeriesName, DataSeries = dataSeries, AntiAliasing = false, StrokeThickness = 2 };

        return new ChartSeriesViewModel(dataSeries, renderSeries);
    }
}


<UserControl x:Class="MattLibrary.ChartLibrary.Views.TestControl"
         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:s="http://schemas.abtsoftware.co.uk/scichart"
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300"
         DataContext="{Binding RelativeSource={RelativeSource Self}}">
<Grid>

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

    <s:SciChartSurface Grid.Row="0" SeriesSource="{Binding Series1}">

        <s:SciChartSurface.XAxis>
            <s:DateTimeAxis 
                            Visibility="Visible"
                            LabelProvider="{Binding XAxisFormat}" 
                            VisibleRange="{Binding SharedXRange}"
                            GrowBy="0.01, 0.01"/>
        </s:SciChartSurface.XAxis>

        <s:SciChartSurface.YAxis>
            <s:NumericAxis 
                            Visibility="Visible"
                            AxisAlignment="Right"
                            TextFormatting="{Binding YAxisFormat}" 
                            GrowBy="0.03, 0.03" 
                            AutoRange="Always"/>
        </s:SciChartSurface.YAxis>

        <s:SciChartSurface.ChartModifier>

            <s:ModifierGroup s:MouseManager.MouseEventGroup="SharedMouseGroup">

                <s:ZoomPanModifier IsEnabled="True" ReceiveHandledEvents="True" XyDirection="XDirection" ExecuteOn ="MouseLeftButton"/>
                <s:RubberBandXyZoomModifier IsEnabled="True" ReceiveHandledEvents="True" IsXAxisOnly="True" ExecuteOn="MouseRightButton"/>

            </s:ModifierGroup>
        </s:SciChartSurface.ChartModifier>

    </s:SciChartSurface>



    <s:SciChartSurface Grid.Row="1" SeriesSource="{Binding Series2}">

        <s:SciChartSurface.XAxis>
            <s:DateTimeAxis 
                            Visibility="Visible"
                            LabelProvider="{Binding XAxisFormat}" 
                            VisibleRange="{Binding SharedXRange}"
                            GrowBy="0.01, 0.01"/>
        </s:SciChartSurface.XAxis>

        <s:SciChartSurface.YAxis>
            <s:NumericAxis 
                            Visibility="Visible"
                            AxisAlignment="Right"
                            TextFormatting="{Binding YAxisFormat}" 
                            GrowBy="0.03, 0.03" 
                            AutoRange="Always"/>
        </s:SciChartSurface.YAxis>

        <s:SciChartSurface.ChartModifier>

            <s:ModifierGroup s:MouseManager.MouseEventGroup="SharedMouseGroup">

                <s:ZoomPanModifier IsEnabled="True" ReceiveHandledEvents="True" XyDirection="XDirection" ExecuteOn ="MouseLeftButton"/>
                <s:RubberBandXyZoomModifier IsEnabled="True" ReceiveHandledEvents="True" IsXAxisOnly="True" ExecuteOn="MouseRightButton"/>

            </s:ModifierGroup>
        </s:SciChartSurface.ChartModifier>



    </s:SciChartSurface>

</Grid>

  • bbmat asked 8 years ago
  • last active 8 years ago
1 vote
19k views

Hi there. I have many chartwindows each with price and volume panes. Each chart has own ViewModel instance as datacontext. I need cursor to be synchronized in each chart between price chart and volume chart.
If I write in xaml <s:ModifierGroup s:MouseManager.MouseEventGroup="xxx"> it synchronizes all cursors of all charts. So I’m trying to do the following:

<s:ModifierGroup s:MouseManager.MouseEventGroup="{Binding MyMouseGroup}">

In ViewModel (part of code from different blocks):

private string _myMouseGroup;
_myMouseGroup = Guid.NewGuid().ToString();
       public string MyMouseGroup
        { get { return _myMouseGroup; }  }

But it’s not worked, Cursors are not synchronized in one chart. I understand that MyMouseGroup should be not string type but dependency property though in Xaml I can use any string. But I don’t have enough programming knowledge to figure out how to do it. Please help with that MyMouseGroup property.

  • RTrade A asked 10 years ago
  • last active 9 years ago
Showing 6 results

Try SciChart Today

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

Start TrialCase Studies