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.

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.