Free Support Forum - aspose.com

CategoryAxis.TickLabelSpacing only uses values >= 2

I need the TickLabelSpacing property to be able to be set to 1. I’ve done some tests and found that I can set the value to >= 2 and the value works correctly, setting it to 1 has no effect.

I’ve put some code together to demonstate the issue.

using System;
using Aspose.Excel;

namespace Excel2AsposeFormula
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
#region OpenFile and Init C [Cells]
Excel.SetLicense(@“C:\Aspose.Excel.lic”);
Excel E = new Excel();

Cells C = E.Worksheets[0].Cells;
#endregion

C.SetColumnWidth(0, 10);
C.SetColumnWidth(1, 10);
C[0, 0].PutValue(“Age”);
C[0, 1].PutValue(“Income”);
double Income = 50000.00;

for(int i = 1; i < 52; i++)
{
C[i, 0].PutValue(i-1);
C[i, 1].PutValue(Income);
C[i, 1].Style.Number = 42;
Income = Income + (Income * 0.05);
}

int ChartIndex = E.Worksheets[0].Charts.Add(ChartType.Bar3DClustered, 0, 4, 50, 20);
Aspose.Excel.Chart Ch = E.Worksheets[0].Charts[0];

Ch.NSeries.Add(“B2:B52”, true);
Ch.NSeries.CategoryData = “A2:A52”;

Aspose.Excel.ASeries S;
S = Ch.NSeries[0];
S.Name = “=B1”;

Ch.CategoryAxis.TickLabelSpacing = 1;
Ch.CategoryAxis.TickMarkSpacing = 1;

Ch.IsLegendShown = true;
Ch.Title.Text = “Age vs. Income”;

#region SaveFile
try
{
E.Save(@“C:\Output.xls”, FileFormatType.ExcelXP);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
#endregion
}

}
}

Hi,

Thanks for your feedback. I will check it ASAP.

Hi,

It’s fixed in hotfix 1.9.4. Please download it and have a try.