Search code examples
.netpositionlabelmschart

How can I adjust the position of the x axis labels of a MS Chart in .NET?


I have a chart that I'm generating on the fly through a generic handler. I've got the data loaded and by default it looks like this:

http://www.2gtech.com/downloads/ChartWithoutCrossing.png

If I adjust the crossing I get the desired effect I'm looking for, which is a base line at 100,000 with the area charted above and below the base line. The problem is that both AxisX and AxisX2 drop to the new crossing point.

GrowthChart.ChartAreas(0).AxisY.Crossing = 100000

http://www.2gtech.com/downloads/ChartWithCrossing.png

How can I keep the crossing point, but have the x axis labels appear BELOW the entire chart? (I don't need the labels on the top, fwiw. They only appear as I was trying to see what I could do with both axis.


Solution

  • IsMarksNextToAxis is the property to achieve this.

    GrowthChart.ChartAreas(0).AxisX.IsMarksNextToAxis = False