can show XAxis vertical

Nov 23, 2011 at 2:56 PM

can show XAxis  vertical

i have a lot of XAxis name to show in chart but i want to show vertical 

to show all the name 

please help 

Developer
Nov 23, 2011 at 6:28 PM
Edited Nov 23, 2011 at 6:30 PM

Download the latest change set (14599) from here [direct link]. Axes have the added "labels" property which in turn lets you set the rotation for axis labels using "rotation". Set it to "-90" and  your problem should be solved.

Regards,

Rahul

Dec 4, 2011 at 11:43 AM

no

is doesnot work for AreaSplineChart

i want show XAxis  vertical or rotate it 

i have many point 

name in the below chart can conflit and not read 

Developer
Dec 4, 2011 at 7:43 PM

You were right, there was a problem with the AreaSpline charts which prevented them from showing the X-Axis vertically. To fix this, you can either download the latest version of the library from here,  

OR

alternately, you could make the following changes in AreaSplineChart.cs

1. Before

 

chart: { renderTo: '[@Id]', defaultSeriesType: '[@RenderType]' },

After:

 

    [@Theme]
    [@Colors]

 

2. Insert the following lines after    script = script.Replace("[@Id]", this.ClientID);

 

  Appearance.renderTo = this.ClientID;
  Appearance.defaultSeriesType = RenderType.areaspline.ToString();

  script = script.Replace("[@Colors]", Colors.ToString());
  script = script.Replace("[@Theme]", Appearance.ToString());
            

 

After making these changes, you simply need to add the following line to your .aspx.cs file to get the vertical x-axis as shown here.

 

<chartControl>.Appearance.inverted = true;

 

However, if you simply want the axis label to appear vertically, my earlier suggestion still holds true.

This problem also existed in the older versions of AreaChart.cs and BarChart.cs, so you might want to make the change in those files as well..

Regards,

Rahul

Jun 7, 2012 at 2:55 PM

I can't seem to get the rotation working for the labels in the xaxis.  can you post a code example or statement to set the rotation?

When I try to do this 

hcLineChart.XAxis[0].labels.rotation = -90;

 

I get a Object reference not set to an instance of an object error

 

Thanks,

Chuck


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)