Search code examples
spreadsheetgear

Changing Spreadsheetgear axis title orientation on a column chart


I am using Spreadsheetgear to create charts in Excel. I create a column chart with an axis title on the y-axis.

chart.Axes[SpreadsheetGear.Charts.AxisType.Value].HasTitle = true;
chart.Axes[SpreadsheetGear.Charts.AxisType.Value].AxisTitle.Text = "Market Value";

However, the axis tile is in a horizontal orientation. I want it in a vertical orientation, but have not been able to find a way to do that in my code. (In Excel, I can rotate the axis title changing its orientation.)


Solution

  • Axis title rendering support, as well as rotated text support, was added in SpreadsheetGear 2009.

    Here is an example of changing the axis title orientation from the API:

    SpreadsheetGear.Charts.IAxis axis = chart.Axes[SpreadsheetGear.Charts.AxisType.Value];
    axis.HasTitle = true;
    axis.AxisTitle.Text = "Market Value";
    axis.AxisTitle.Orientation = -90;