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


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)

            //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);
                    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.