Pre loader

Tag: MouseEventGroup

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
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
10k views

Hi,

I’ve got an issue with ChartModifiers in following scenario. I’ve got bunches of signals, where every signal carry data from different sensor. Bunches are recorded at individual sessions. I need to look at them collectively, so I choose some signals from one bunch and some signals from another bunch, where one signal = one SciChartSurface control and every SciChartSurface control is aligned in sequencer-like way (like yours Multi-Pane Stock Chart example), because I want to see signals one under another. I need to have some group of ChartModifiers acting on all choosen signals, because time scale should be preserved (as in yours example) – it works in my solution. But I also need to apply a modifier to pan, that should works only on signals that are part of certain bunch, because starting point in time of certain bunch signals don’t have to be preserved.

Assuming, zoom should works on every signal from every bunch, but panning should works only on signals from one bunch. I already gain zoom functionality by the means of ModifierGroup and MouseManager.SetMouseEventGroup(), but i don’t know how to add the panning. Could you give me any suggestions, how can I handle this?

I’m sending some screens below.

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
0 votes
7k views

Hi,

I have 2 separate charts (SciChartSurface) and my goal is to enable mouse selection of a series on only the chart surface that contains the series. I do not share renderable series and not even data series between different chart surfaces. I am not sure why a series on the second chart surface is selected when I click on an area within the first chart surface. How can I prevent this from happening?

Could it be this is a bug in that SeriesSelectionModifier checks for hitpoints beyond the chart surface on which the mouse hit occurred? I verified and this problem only occurs when sharing Chart Modifiers via MouseManager. Attaching the MouseManager.MouseEventGroup to each individual modifier does not seem to work, it looks like it has to be attached to “ModifierGroup”. So I am still stuck with this problem.

<s:SciChartSurface.ChartModifier>
            <s:ModifierGroup s:MouseManager.MouseEventGroup="MyMouseEventGroup">

                <s:SeriesSelectionModifier ReceiveHandledEvents="True">
                    <s:SeriesSelectionModifier.SelectedSeriesStyle>
                        <Style TargetType="s:BaseRenderableSeries">
                            <Setter Property="StrokeThickness" Value="10"/>
                        </Style>
                    </s:SeriesSelectionModifier.SelectedSeriesStyle>
                </s:SeriesSelectionModifier>

                <s:RubberBandXyZoomModifier ReceiveHandledEvents="True" IsAnimated = "False" IsXAxisOnly = "True" ExecuteOn = "MouseRightButton"/>
                <s:CursorModifier ReceiveHandledEvents="True" SourceMode="AllSeries" ShowAxisLabels="True" />
                <s:ZoomPanModifier ReceiveHandledEvents="True" XyDirection="XYDirection" ClipModeX = "ClipAtExtents" ExecuteOn ="MouseLeftButton"/>
                <s:MouseWheelZoomModifier ReceiveHandledEvents="True" XyDirection = "XDirection"/>
                <s:ZoomExtentsModifier ReceiveHandledEvents="True" IsAnimated = "False" ExecuteOn = "MouseDoubleClick"/>
                <s:LegendModifier ReceiveHandledEvents="True" Name="GeneralLegend" ShowLegend="True" LegendPlacement ="Inside" GetLegendDataFor="AllSeries" Margin="10" LegendItemTemplate="{StaticResource LegendItemTemplate}"/>


            </s:ModifierGroup>
        </s:SciChartSurface.ChartModifier>
  • bbmat asked 8 years ago
  • last active 8 years ago
1 vote
0 answers
16k views

I’m trying to MouseEventGroup:

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

Where SharedMouseGroupId is

    private String sharedMouseGroupId;
    public String SharedMouseGroupId
    {
        get { return this.sharedMouseGroupId; }
        set
        {
            this.sharedMouseGroupId = value;
            RaisePropertyChanged(() => SharedMouseGroupId);
        }
    }

And init:

        SharedMouseGroupId = Guid.NewGuid().ToString();

But this doesn’t work.
If i subscribe on Loaded event of surface and manually set MouseEventGroup, this work.

        MouseManager.SetMouseEventGroup((DependencyObject)c.ChartModifier, ViewModel.Parent.SharedMouseGroupId);
Showing 5 results

Try SciChart Today

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

Start TrialCase Studies