Reputation: 63
I have a chart with a Y axis of 0 to 1 and X axis in date time. I also have the horizontal scrollbar enabled on zoom. My problem is that, the data points which have a value of 0 are being clipped with the scrollbar. So can I move it a few pixels below the chart or move the Y axis slighty?
Regards.
Upvotes: 1
Views: 1076
Reputation: 54433
No, you cannot position the scrollbar directly.
But you can either move the scrollbar out of the innerplot area:
yourXAxis.ScrollBar.IsPositionedInside = false;
or move the x-axis (!) a little up:
Axis ay = yourChartArea.AxisY;
ay.Interval = 2; // pick your interval!
ay.Minimum = -0.75f; // pick a value that works for you
ay.IntervalOffset = -ay.Minimum; // adapt the interval
Note that this is not in pixels but in data values of the Axis! You could convert pixels <-> values in the PrePaint
or PostPaint
event using the PixelPositionToValue
and ValueToPixelPosition
functions.
Below are the results: Before, after IsPositionedInside = false
and after moving the x-axis:
Upvotes: 2