1

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 Answers1

0

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.

CobyC
  • 2,058
  • 1
  • 18
  • 24
  • Thank for answering, for the Axis X there is a way to get only the height ? Because MSChart takes some space up and down and i dont have the hand on it. I tried something like MSChart.ChartArea.Position - MSChart.ChartArea.InnerPlotPosition but there is a little gap due to the up space taken by MSChart. – Tom Flenner Jul 29 '20 at 09:04
  • @Tom Flenner is it posible to update your question with a picture to show what you mean? – CobyC Jul 29 '20 at 13:26
  • I don't think there is a value that gives that value did [this answer](https://stackoverflow.com/questions/7283394/ms-charts-getting-the-real-innerplotposition/7301999) help at all? I think it is something that will have to be calculated. – CobyC Jul 30 '20 at 19:41