I am using Microsoft Chart Control.
I am trying to adjust the height of a chart area programmatically. Depending on the lines. Because the Microsoft Chart control requires a height that cannot be a percentage, not Auto. Depending on the query you select, the chart may have 1 bar or it may have 100. That's why I need to adjust the height because large data sets seem twisted and unreadable.
I tried to add a counter heightCounter, which is the number of bars in the chart.
int newHeight = (heightCounter * 10);
if (newHeight > 32767)
newHeight = 32767;
Chart1.Height = newHeight;
This sometimes works OK with smaller datasets.

but when I have very large datasets, the name looks very spaced because the height is too high.

Is there a proper way to achieve this?