Pre loader

YAxisVisiblerange not correctly reseting after doubleclick

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
0

Hallo once again,

Im trying to set/control my YAxis visiblerange. With good help I was able to come up with the piece of code below. However one more problem arrives with this solution. When i double click on the chart and there is no fixed visiblerange to set, then the corresponding YAxis must go back to normal (sse code). However this has bugs undesirably i must doubleclick twice in order for the YAxisRange to go back to normal. The first time does change the YAxisRange but not good. The second time finish the job correctly.
Does anyone has any idea why this happens? It should go back to normal from the first doubleclick.

    public class CustomZoomExtentsModifier : ChartModifierBase
    {
        public override void OnModifierDoubleClick(ModifierMouseArgs e)
        {
            base.OnModifierDoubleClick(e);

            //This piece of code is for setting the YAxis Limit, the limmit is Set only OnZoomExtends           
            
                if (this.YAxis.IsFixedRange)
                {
                    this.YAxis.VisibleRange = RangeFactory.NewWithMinMax(this.YAxis.VisibleRange, this.YAxis.YMinRange, this.YAxis.YMaxRange);
                }
                else
                {
                    var newYRange = this.YAxis.GetMaximumRange();
                    if (newYRange != null && newYRange.IsDefined) this.YAxis.VisibleRange = newYRange;
                }

            // And we must calculate the VisibleRange of X Axis, otherwise it will not zoom back to normal
            var newXRange = this.XAxis.GetMaximumRange();
            if (newXRange != null && newXRange.IsDefined) this.XAxis.VisibleRange = newXRange;
            
        }
    }
  • You must to post comments
Showing 0 results
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