Problem with CategoryAxis Crossat

I am using a designer workbook as a template and I am trying to change both category axis and value axis parameters (min value, max value and cross at values). It works for value axis both for category axis I can not change the cross at value. In my case it defaults to 1.0 when min and max are .18 and .95 respectively.

Hi,

Which version of Aspose.Cells for .NET you are using. I tried your scenario with the attached version (4.4.3.15) and it works fine. Please try it.

Sample test code:

Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
workbook.Open(@"d:\test\ChartBook.xls");
Aspose.Cells.Chart chart = workbook.Worksheets[0].Charts[0];
chart.ValueAxis.CrossAt = 1000;
workbook.Save("d:\\test\\out_ChartBook.xls");

If you still find the problem, post your template file with sample code, we will check it soon.

Thank you.

Here’s the sample code and template attached. Evaluating the product, so I do not have the license (if it makes a difference!)
Problem seems to occur when axis min, max crossat values are not integers… I can not get the red part of the code work properly.

Dim wb As New Workbook
wb.Open(Server.MapPath(“excels\testtemplate2.xls”), FileFormatType.Default)
Dim chart As Chart = wb.Worksheets(0).Charts(0)

With wb.Worksheets(1)
.Cells(0, 2).PutValue(0.6)
.Cells(0, 3).PutValue(50)

.Cells(1, 2).PutValue(0.7)
.Cells(1, 3).PutValue(75.5)
End With



'Convert the chart to an image file.
With chart.CategoryAxis
.MinValue = 0.4
.MaxValue = 0.8
.CrossAt = 0.65
'This value seems to default to max at the image, and min at the saved copy and auto crossat is turned on even when it is not on in the template and not turned on by the code.
End With


’This part seems to work properly
With chart.ValueAxis
.MinValue = 40
.MaxValue = 80
.CrossAt = 63
End With


Dim bitmap As System.Drawing.Bitmap = chart.ToImage()


bitmap.Save(Server.MapPath(“excels/test22.jpg”), System.Drawing.Imaging.ImageFormat.Jpeg)

With Image1
.ImageUrl = “excels/test22.jpg”
.Visible = True
End With

wb.Save(Server.MapPath(“excels/test22.xls”))

Hi,

Thanks for providing us the template file with code.

We found the issue and will provide you a fix soon.

Thank you.

Hi,

Please try this fix.

We have fixed this bug of CatergoryAxis crossat problem.

And we have fixed the bug of the wrong position of ValueAxis in Charts2Image.

We are still working on trendline in Charts2Image. Thanks for you patience.