Free Support Forum - aspose.com

Controlling Chart Category Axis label intervals

Hello,

I have a chart where the labels on the Category access are string values. I am looking for something like Excel's Specifiy Interval Unit that I can simply set to a value. I am unable to find a solution that will work for string values in aspose cells.

Thank You.

Hi,

Could you create your sample chart in MS Excel and post the template file here, We will check and tell you how to create your desired chart with Aspose.Cells APIs.

Thank you.

Hello,

I have attached 2 files. One is the Excel file generated by my code. The other is the same file that I manipulated after creation to have the category labels as desired it has (corrected) in the file name. The excel file is generated entirely in code, unfortunately using a template is not an option.

Thanks.

Hi,

Thanks for providing us the template excel files.

I have checked and found that you have set tick label spacing (In MS Excel open the file i.e.., "ConformingByFA.xls" containing the chart, right click on the categories axis labels, click format axis, check the second option "Number of categories b/w tick mark labels") to "2" (should be "1").

So you can try add the following code to your code:

E.g.,

.
.
.
Aspose.Cells.Chart chart = worksheet.Charts[chartIndex];
Axis categoryAxis = chart.CategoryAxis;
categoryAxis.TickLabelSpacing = 1;
.
.
.

And alway try the latest version of Aspose.Cells (4.4.3 or greater) to create the chart.

Thank you.