We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

CategoryAXis Labels are automatically slanted if length is large

Hello,


I am working on a chart with category axis that has date values. I have noticed that sometimes they get automatically slanted 45 degrees if the chart width is not wide enough. How can i know if this occurs or not in the backcode since i need to fix the height of the category axis.

Please help urgently.
Thanks,
Nazha

Hi Nazha,

I have observed the scenario shared by you and like to share that Aspose.Slides allows you to manually set the text direction for category axis. However, there is no automated way to identify that if the automatically selected category axis labels will be slanted or not. However, you can use the following sample code to set the angle for category axis labels.

public static void TestChart()
{
Presentation pres = new Presentation();
ISlide slide = pres.Slides[0];

IChart chart = slide.Shapes.AddChart(ChartType.ClusteredColumn, 100, 100, 500, 400);

IAxis axis = chart.Axes.HorizontalAxis;
axis.Position = AxisPositionType.Right;

axis.Position = AxisPositionType.Bottom;

axis.TextFormat.TextBlockFormat.TextVerticalType = TextVerticalType.Vertical270;
axis.TextFormat.TextBlockFormat.AnchoringType = TextAnchorType.Center;

axis.TickLabelRotationAngle = 20;

pres.Save(“D:\Aspose Data\GenChart.pptx”, SaveFormat.Pptx);
}

Please share if I may help you further in this regard.

Many Thanks,