1
votes

After a quick look in the MSChart code with DotPeek, I didn't find anything.

Does someone know how to get the Axis height in a ChartArea? Like the size used by an Axis in the Position object of the ChartArea.

Exemple:

Exemple

I want the size (height and width in percent) of the red rectangle of this chart, because every Position and ElementPosition are in percent.

I tried something like this :

(100 - MSChart.ChartArea.InnerPlotPosition.Height) * (MSChart.ChartArea.Position.Height / 100)

But i have some trouble with the space that MSChart takes up too.

1

1 Answers

0
votes

If you are looking for the value on the Y axis on a chart you can get the Maximum value by looking at the chart area.

You will have to determine your chart area as it can be a collection or char areas. chart1.ChartAreas[0].AxisY.Maximum

on this chart it is 30

enter image description here

and chart1.ChartAreas[0].AxisX.Maximum is 11.

According to the documentation the InnerPlot area is the size of the plotting area. enter image description here in this graph it is Size: {Width = 88.3745 Height = 80.81133}

if that doesn't answer your question then this question might point you in the right direction.