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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

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 chartprivate 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 rangethank you for replies
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.