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

Free Support Forum - aspose.com

Charts: Setting X-Axis position relative to Y-Axis


When doing a line chart, by default, the X axis is drawn on the 0 position of the Y Axis. However, we have some charts that goes into the negative, and the user wants the x-axis to always be at the bottom of the chart, rather than on the 0 line of the Y axis.

Additionally, they would also like to have a horizontal line on the 0 position of the Y axis, but this line should not have any ticks or labels on it.

Is this possible?


I found the answer for the first part.

For the benefit of anyone else who asks this question:

_xlsChart.ValueAxis.CrossType = Aspose.Cells.Charts.CrossType.Custom;
_xlsChart.ValueAxis.CrossAt = minValue;

Now only for that 0 line. I’m assuming that I can achieve this using the SecondCategoryAxis, but how do I set its cross at value on the Y axis, since there is only one CrossAt Property?


Thanks for your posting and using Aspose.Cells.

Please provide us your code and your actual and expected output xls/xlsx file and the screenshot by highlighting the difference with red circles.

Please also download and try the latest version:
Aspose.Cells for .NET (Latest Version)


Unfortunately, what I thought would be my solution did not work. I need the chart to be drawn from the zero line, but I need the tick labels to be at the bottom of the chart. I’m not even sure how the user managed to achieve this in Excel, never mind translating it into ASPOSE code.

I’ve attached the chart.

Ah, I finally found it!

Here’s the code to do it:

_xlsChart.CategoryAxis.TickLabelPosition = Aspose.Cells.Charts.TickLabelPositionType.Low;

Thanks :slight_smile:


It’s good to know you were able to sort out this problem. It will be helpful thread for others.

If you have any other question, please feel free to post it, we will help you asap.