How to format axis & gridlines in a line chart

Can anyone let me know why my line chart is not setting the Axis Options?
Thanks, -Duke
// WORKING
chart.CategoryAxis.MajorGridLines.IsVisible = true; // this works
chart.CategoryAxis.MajorTickMark = Aspose.Cells.Charts.TickMarkType.Outside; // this works
// NOT WORKING
chart.CategoryAxis.MajorGridLines.IsAuto = false; // does nothing, Major unit: set to Auto (assuming property should be set to Fixed)
chart.CategoryAxis.MajorUnitScale = Aspose.Cells.Charts.TimeUnit.Days; // does nothing, Major unit: set to Months
chart.CategoryAxis.MajorUnit = 28; // does nothing, Major unit: set to 1
 
 

Hi,


I have tested your case and checked your mentioned properties, it works fine same as MS Excel.

Please give us complete sample code or preferably sample console application(you may zip it) to show the issue, we will check your issue soon.

Thank you.

Here's a web project. Sorry I couldn't get the aspose.cells dll to compile in a console app.

I have included a file that shows how I want the chart gridlines to be formatted.

Thanks,
-Duke

Hi,


Thanks for the project.

I have tested your issue with your project and found the issue. Almost everything is working fine but the category axis’s major units scaling is not specified to Days, it always comes as Months.

Sample code segment that I tried with different combinations updating your code segment:


//…


// Set Major Gridlines X
chart.CategoryAxis.MajorGridLines.IsVisible = true;
chart.CategoryAxis.MajorTickMark = Aspose.Cells.Charts.TickMarkType.Outside;
chart.CategoryAxis.MinorTickMark = Aspose.Cells.Charts.TickMarkType.Outside;
chart.CategoryAxis.CategoryType = Aspose.Cells.Charts.CategoryType.TimeScale;
chart.CategoryAxis.MajorGridLines.IsAuto = false;
chart.CategoryAxis.MajorUnitScale = Aspose.Cells.Charts.TimeUnit.Days; //this does not work.
chart.CategoryAxis.MajorUnit = 28;
chart.CategoryAxis.MinorUnitScale = Aspose.Cells.Charts.TimeUnit.Days;
chart.CategoryAxis.MinorUnit = 7;
chart.CategoryAxis.MinValue = new DateTime(2010, 07, 23);
chart.CategoryAxis.MaxValue = new DateTime(2011, 07, 15);
chart.CategoryAxis.TickLabels.NumberFormat = “m/d/yyyy”;
chart.CategoryAxis.BaseUnitScale = Aspose.Cells.Charts.TimeUnit.Days;

I have logged your issue with an id: CELLSNET-29067. We will figure it out soon.

Thank you.

Hi,

We have fixed the following issue. Please download: Aspose.Cells for .NET v6.0.0.5.

Please use the following code.

C#


chart.CategoryAxis.CategoryType = Aspose.Cells.Charts.CategoryType.TimeScale;

chart.CategoryAxis.MajorUnitScale = Aspose.Cells.Charts.TimeUnit.Days; // does nothing, Major unit: set to Months

chart.CategoryAxis.MajorUnit = 28; // does nothing, Major unit: set to 1

chart.CategoryAxis.BaseUnitScale = Aspose.Cells.Charts.TimeUnit.Days;

Thanks for the update, everything is working now.

-Duke

The issues you have found earlier (filed as 29067) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.