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

Free Support Forum - aspose.com

Chart to Image bug (?) with long-ish axis labels

Hi,

I'm using aspose.cells to generate an image from a set of charts.

Most charts convert fine, but the y-axis labels on one bar chart are wrong.

I have attached the following files:

  • actual.jpg - the saved image
  • aim.jpg - the expected image
  • bug sample.xlsx - the spreadsheet containing the original chart

If you are able to confirm this is a problem with aspose, or can recommend a work-around, that would much appreciated.

Thanks,

Steve

Hi Steve,

We are working on the issue. Can you please forward us the code which you are using . This will help us finding the issue.

Thanks,

Hi Steve,

In the mean while please use:
chart.CategoryAxis/ValueAxis.TickLabels.Rotation = 0;
to set the labels horizontally.

Thanks,

Hi there,

Thanks for the quick reply. The relevant code as requested:

m_appExcel.CalculateFormula()

Dim mysheet As Worksheet = m_appExcel.Worksheets(sSheet)

Dim bitmap As System.Drawing.Bitmap

Dim oChart As Charts.Chart

Try

Dim oOptions As New Rendering.ImageOrPrintOptions

oOptions.HorizontalResolution = 300

oOptions.VerticalResolution = 300

If IsNumeric(sEntityNumber) Then

oChart = mysheet.Charts(CInt(sEntityNumber) - 1)

Else

oChart = mysheet.Charts(sEntityNumber)

End If

If Not oChart Is Nothing Then

oChart.Calculate()

bitmap = oChart.ToImage(oOptions)

Else

LogEvent(m_sJobStartTime, LogType.LogError, "Unable to locate the chart " & sEntityNumber & ".")

Exit Sub

End If

Catch ex As Exception

LogEvent(m_sJobStartTime, LogType.LogError, "Unable to locate the chart " & sEntityNumber & ".")

Exit Sub

End Try

Dim sFile As String = m_sResultsFolder & "\" & sTitle & ".png"

'Save the chart image file to disk.

bitmap.Save(sFile, System.Drawing.Imaging.ImageFormat.Png)

Hope this helps!

Cheers,

Steve

Hi,


Please use the latest fix (attached). The labels issue will be fixed, but the y scales might not be right. So, you can set the majorunit to value 2 before converting.

<span style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”;”>e.g

book.Worksheets[“Sheet1”].Charts[0].ValueAxis.MajorUnit
= 2

Wow, thanks for the quick turn-around- once again, 10/10 for aspose techical support!

Although in this case, your earlier suggestion of forcing rotationangle has fixed the issue, and as this is going straight to a production system, I prefer this to testing and deploying a new hotfix :)

Cheers,

Steve