X-Axis Label Rotation LineChart

Aug 17, 2012 at 1:25 AM

I can't seem to get rotation to work on the Axis Labels.

highLineChart.XAxis[0].labels.rotation = -90;
highLineChart.DataSource = series;
highLineChart.DataBind(); 

throws a Object reference not set to an instance of an object.

Any suggestions or links to proper documentation would be helpful.

Sep 7, 2012 at 3:58 PM

This took me a while. You have to apply the rotation before you create the xAxis and add it to the chart.

VB Code:

Dim myXAxis As New Highchart.Core.XAxisItem()
myXAxis.categories = myDates 'whatever code you normally use to populate the xAxis goes here
Dim myLabels = New Highchart.Core.Labels()
myLabels.rotation = -90
myXAxis.labels = myLabels
LineChart1.XAxis.Add(myXAxis)