Chart image rendering

Hi,

We have code using Aspose.Slides/Cells/Words, in which we convert documents to images and images/charts contained within documents to images.

We’ve been noticing that when dealing with charts contained in images, the chart will often not match the charts as displayed in the original document. This specifically happens when dealing with 3D charts or charts containing legends.

As an example our Aspose.Cells code will loop over all shapes on a sheet and call ToImage() on the shape;

this.imageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
this.imageOptions.Transparent = true;
this.imageOptions.ChartImageType = System.Drawing.Imaging.ImageFormat.Png;

foreach (Aspose.Cells.Drawing.Shape shape in sheet.Shape)
{
using (MemoryStream memoryStream = new MemoryStream())
{
shape.ToImage(memoryStream, this.imageOptions);
// Use the stream…
}
}

Is there anything we can be doing to keep the rendered image matching how the original chart is displayed, for each of the Aspose libraries mentioned above. We need the image to be an accurate representation of the original

Tim

Hi Tim,

I would like to address your issue/requirements from Aspose.Cells perspective.

Could you download and use our latest version/fix: Aspose.Cells for .NET v7.7.2.3 if it makes any difference.

If you still find the issue, kindly separate the issue regarding Aspose.Cells and do post us your template Excel file containing the chart / shapes that you are rendering to image file, we will check it soon.

Thank you.
Hi Tim,

I would like to address your issue/requirements from Aspose.Words perspective.

Thanks for your inquiry. In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v14.1.0) from here.

Regarding your query about dealing with 3D charts, unfortunately Aspose.Words does not support perspective view upon rendering 3D charts and rendering of DrawingML 3D Effects. It would be great if your please share your input Word document here for testing. I will investigate the issue on my side and provide you more information about your query.

The 3 attached documents all display the 3D chart perspective issue when processed in their respective libraries.

Additionally, when chart3D.xlsx is processed in Aspose.Cells, the pie chart in the document has its legend altered from the orginal. In the original document the legend scale goes from 1-10 but in the rendered image the legend scale goes from 1-20.

We are using the most up to date libraries for Aspose.Cells, Aspose.Slides and Aspose.Words.

Thanks

Hi,


Thanks for the template file(s).

After an initial test, I observed the following two issues when rendering charts in your template Excel file to image format using Aspose.Cells for .NET v7.7.2.3 ( latest):

1) Area 3-D chart - The horizontal category axis intervals are wrong.
2) PIE 3-D exploded chart - The legend entries are rendered from 1-20 instead of 1-10.

e.g
Sample code:

Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(“e:\test2\chart3D.xlsx”);
int i = 0;
foreach (Worksheet worksheet in workbook.Worksheets)
{
foreach (Chart chart in worksheet.Charts)
{

i = i + 1;
Bitmap image = chart.ToImage();
image.Save(“e:\test2\tst_chartimg__” + i.ToString() + “.png”, ImageFormat.Png);

}
}

I have logged a ticket with an id “CELLSNET-42443” for your issue. We will look into it soon.

Once we have any update on it, we will let you know here.

Thank you.
Hi Tim,

I would like to address your issue from Aspose.Words perspective.

Thanks for sharing the detail. I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-9801. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

Aspose.Words does not the support perspective view upon rendering 3D charts. Most probably your issue is related to this missing feature (WORDSNET-7988). You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

Thanks for the replies regarding Word and Cells, is anyone able to confirm this bug from a Slides perspective? We can’t currently export chart images from PPTX documents, so for us issues are seen when generating a thumbnail of the slide.

We’ll be keen to hear back from you when you have a resolution to any of these issues.

Thanks

Tim

Hi Tim,

I have worked with the sample presentation file shared by you and have been able to generate the attached slide thumbnail on my end by using Aspose.Slides for .NET 8.4.0. The 3-D effects on chart are missing in generated thumbnail. Is this is the issue that you are having on your end. If yes, then I like to share that Aspose.Slides does not presently support 3-D effects in rendering and for this reason such effects are unavailable in rendered images. An issue with ID SLIDESNET-35118 has already been added in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.


public static void GenPPTXThumbnail(String presName,String path)
{
//begin process of converting pptx to png and inserting db entries for these images.
PresentationEx pres = new PresentationEx(path + presName);

//some code here that doesn’t have to do with the presentationex class

for (int x = 0; x < pres.Slides.Count; x++)
{
Console.WriteLine(“Writing Slide {0} of {1}”, x, pres.Slides.Count);

//Access the first slide
var slide = pres.Slides[x];
//Create a full scale image
Image bmp = slide.GetThumbnail(2f, 2f);
bmp.Save(path+“Slides\PPTX_Thumb_”+(x+1).ToString()+".png", System.Drawing.Imaging.ImageFormat.Png);
}

}

We are sorry for your inconvenience,

Yes, this is the issue that we are having. Thanks for the update, any idea when this might be fixed in Aspose.Slides?

Tim

Hi Tim,

I like to share that 3-D rendering support is likely to get included in Aspose.Slides for .NET by end of Q2 of 2014. Once the 3-D rendering support will be available, the concerned issue will get resolved afterwards. I will share the feedback with you as soon as the issue will be available.

Many Thanks,

Hi,


Please try
the new version/fix
: Aspose.Cells for .NET v7.7.2.5 We fixed the x-axis labels and legend items issues. But the
3D-perspective feature is not supported yet.


Once we support the 3D-perspective in rendering image files, we will let you know here.


Thank you.