bchu1392
bchu1392

Reputation: 69

Reducing ZedGraph margin

Can anyone please tell me how to reduce the margin between my graphPane to the border? I want to start at the bottom edge of the graph, have some clearance on top, left and right of the graph. I tried this but it gives me some weird zoomed in figure.

graphPane.YAxis.Scale.Min = lowerPoint;
graphPane.YAxis.Scale.Max = higherPoint+offset;
graphPane.XAxis.Scale.Min = leftPoint + offset;
graphPane.XAxis.Scale.Max = rightPoint + offset;

Upvotes: 1

Views: 822

Answers (1)

discomurray
discomurray

Reputation: 14839

You can remove the 'margin' by manually setting the Rect property of the Chart

float leftMargin = 10;
float rightMargin = 10;
float topMargin = 10;
float bottomMargin = 5;
float width = 1920;
float height = 1080;
graphPane.Chart.Rect = new RectangleF(leftMargin, topMargin, width - leftMargin - rightMargin, height - topMargin - bottomMargin);

Upvotes: 2

Related Questions