Pre loader

double ZoomExtentsModifier

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
0

Hello

I’m trying to use 2 synchronized charts, based on SciChart sample “Sync Multi Chart Mouse”. In my case dataseries have different X ranges.
I see strange behavior with ZoomExtentsModifier. If use this modifier only on first chart, behavior looks fine. In case if I place second modifier, reset zoom works strange. First time it resets first chart, second – second chart. Is it right behavior? Is it possible to reset only to whole x range? Project is attached
my v. is 2.1.4951.42786

Attachments
  • You must to post comments
0
0

Hi,

I tried it again and reproduced the issue successfully. It happens due to shared VisibleRange and different data ranges on each chart. Actually, both ZoomExtentsModifiers don’t know about each other, they aren’t connected, but when ReceiveHandledEvents=”True”, an event is passed to all modifiers in the same group. So in the example it depends on which modifier received notification later.

You can easily change this behavior by extending ZoomExtentsModifier in the following way:

    public class ZoomExtentsModifierEx:ZoomExtentsModifier
    {
        public bool PerformZoomToExtents
        { get; set; }

        public override void OnModifierDoubleClick(ModifierMouseArgs e)
        {
            if (PerformZoomToExtents)
            {
                base.OnModifierDoubleClick(e);
            }
        }
    }

..and the XAML should be:

        <visuals:SciChartSurface x:Name="c1" Grid.Row="0">
            .....

            <visuals:SciChartSurface.ChartModifier>
                <s:ModifierGroup mouse:MouseManager.MouseEventGroup="myCustomGroup">
                    .....

                    <sciChartTest:ZoomExtentsModifierEx PerformZoomToExtents="True" ReceiveHandledEvents="True" XyDirection="XDirection"/>
                </s:ModifierGroup>
            </visuals:SciChartSurface.ChartModifier>
        </visuals:SciChartSurface>
        <visuals:SciChartSurface x:Name="c2" Grid.Row="1">
            ....

            <visuals:SciChartSurface.ChartModifier>
                <s:ModifierGroup mouse:MouseManager.MouseEventGroup="myCustomGroup">
                    ....
                    <sciChartTest:ZoomExtentsModifierEx  PerformZoomToExtents="False" ReceiveHandledEvents="True" />
                </s:ModifierGroup>
            </visuals:SciChartSurface.ChartModifier>
        </visuals:SciChartSurface>

Please, try it and let us know if the issue is resolved.

Best regards,
Yuriy

  • sahon
    Yes, this solution works, but it works only for first chart data range, if I narrow data range of first chart private IDataSeries CreateDataSeries1() { var ds0 = new XyDataSeries(); const int countMin = 0; const int countMax = 10; //before was 30 const int count = 1000; for (int i = countMin; i < countMax; i++) { ds0.Append(new DateTime(1990,1,1).AddDays(i), count * Math.Sin(i * Math.PI * 0.1) / i); } return ds0; } not to overlap second chart data range, zooming will work only for first data range. So for me it is not good.
  • sahon
    I've used custom ZoomExtensModifier which extends to whole range via shared visible range thank you for replies
  • You must to post comments
Showing 1 result
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