Page 1 of 1

I don't want to change the y-axis range of a parallel chart by scrolling.

Posted: Fri Jul 02, 2021 8:12 am
by kihoon_sung
I want to prevent the Y axis from being scrolled and changing the range of the parallel chart. Is there no way?
AxisY axisYWeight = new AxisY(_chart.ViewXY);
axisYWeight.SetRange((double)min, (double)max);
axisYWeight.Title.Text = Prop.ITEM_NM;
axisYWeight.Title.VerticalAlign = YAxisTitleAlignmentVertical.Top;
axisYWeight.Position = _chart.ViewXY.YAxes.Count * positionInterval;

Re: I don't want to change the y-axis range of a parallel chart by scrolling.

Posted: Fri Jul 02, 2021 9:03 am
by Arction_LasseP
Hello,

There are several properties controlling axis scrolling and other actions that modify axis range.

-AllowScrolling - when disabled, user cannot scroll the axis by dragging it with mouse.
-AllowScaling - when disabled, user cannot rescale the axis by dragging the scale nibs at the ends of the axis.
-ZoomingEnabled - determines if zooming actions affect this axis.
-PanningEnabled - determines if panning affects this axis

There is also RangeChanged -event which allows you to define various limits for the axis. For example, prevent axis minimum going below zero. It is also possible to stop all axis range changes inside the event.

Code: Select all

_chart.ViewXY.YAxes[0].AllowScrolling = false;
_chart.ViewXY.YAxes[0].AllowScaling = false;
_chart.ViewXY.YAxes[0].ZoomingEnabled = false;
_chart.ViewXY.YAxes[0].PanningEnabled = false;

_chart.ViewXY.YAxes[0].RangeChanged += YAxis_RangeChanged;

        private void YAxis_RangeChanged(object sender, RangeChangedEventArgs e)
        {
            // Axis range never changes
            if (e.NewMax != 10)
                _chart.ViewXY.YAxes[0].Maximum = 10;
            if (e.NewMin != 0)
                _chart.ViewXY.YAxes[0].Minimum = 0;
        }
Best regards,
Lasse