Studley
Studley

Reputation: 63

Chart control is it possible to position the horizontal scrollbar?

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.

enter image description here

Upvotes: 1

Views: 1076

Answers (1)

TaW
TaW

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:

enter image description here enter image description here enter image description here

Upvotes: 2

Related Questions