Charts.ToImage quality

Hi,


Thank you for your interest in Aspose Products and your valuable findings. We will surely test the quality of image using variance of Workbook constructors and let you know the results here.

Thanks again.

Hi.

One more question. I have the following line of code that formats the text on my pie segments:

series.Points[i].DataLabels.Text = e.DataPointLabel + "\r\n" + e.DataPointValue.ToString(DefinitionProperties["###%"]);

In Excel, the text appears as expected. However, when I "toImage" the graph, instead of having a label that says : "Global Equity 12%", I have a label that just says "0.12".

Is this me doing something wrong, or is customization of the DataLabels.Text not supported in the "toImage" functionality?

I noticed this was logged as a bug last year in the Java version. I suspect the bug still exists for .Net? <A href="</A></P> <P>Oh, and one more thing, the labels in the image appear much larger and bolder than it does in excel. Is it possible that we could have that fixed too?</P> <P><FONT size=2><FONT size=3>Thanks</FONT></P></FONT>

Hi,

Please post your generated Excel file (you may save an Excel file containing the updated chart) and output image file, we will check your issue soon.

Thank you.

Hi.

Thanks for the quick response.

Please find both the Excel file and the Word doc attached.

Regards

I have tested your file converting the chart into image file using Aspose.Cells for .NET v5.3.2.6, it works OK, I have attached the output file using the sample code:

var options = new ImageOrPrintOptions();
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Emf;
Workbook wb = new Workbook(“e:\test2\ReportTest1.xlsx”);
Chart chart = wb.Worksheets[0].Charts[0];
chart.ToImage(@“e:\test2\outputImage.emf”, options);

Please try v5.3.2.6.

Thank you.

I just found this post from 2007 as well: https://forum.aspose.com/t/102324

I couldn't figure out whether this post applies to .Net, but in it, the "DataLabels.Text not reflecting on the image" issue was reported as well. In the second last post, Roger Mo reported that the issue will be fixed within that week, so I'm assuming it won't be a big deal to fix.

Hi,

Please check my previous post in this thread.

Thank you.

Thanks so much.

That is reasuring. I'll check through my code to see where I've done it wrong.

Hi,

If you are still not able to generate expected images, please post the whole code you used.

The code should reflect how did you create chart objects using Aspose.Cells API and inserted chart images to word document using Aspose.Words API.

Note:
Aspose.Cells support converting most of the charts to images except bubble 3d and surface chart and it also support most of the features except Perspective ( 3D Rotation --> 3D Format --> Rotation), 3-D Format, Shadow and placing some complex DataLabels of Points of 3D Pie chart to suitable location when the Label Position of the DataLabels are Best Fit.

For further help, please see these images

Hi Shakeel.

I noticed we were still on version 5.1.2.0, and after the update, I've been quite busy replacing the Style property with the GetStyle and SetStyle methods throughout the project.

However, I was able to confirm that the correct label text is now reflected on the image, so I think I'll be ok from here on.

Thanks so much for your help.

Hi,

Thanks for your feedback.

Anyway, I have changed the topic of my above post, so that you or others could find it more easily. It is useful for those who want to know which of chart types and chart features are supported/unsupported by Aspose.Cells API.

Hi


Sorry for troubling again, but my pixelated problem is back again, and non of the suggestions in this post seems to help (See attached)

I’ve tried changing the ImageOrPrintOptions, but nothing seems to make any difference:

public override void AddChart(ChartTemplateTypes chartLayoutType, string titleText, ChartLegendLayoutTemplateTypes legendLayoutType)
{
ExecuteSectionBreaks();
DocApplyTabStops();

base.AddChart(chartLayoutType, titleText, legendLayoutType);

Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
options.ImageFormat = ImageFormat.Tiff;
options.HorizontalResolution = Convert.ToInt32(StylesRoot.ChartTemplates[chartLayoutType].Width * 1000);
options.VerticalResolution = Convert.ToInt32(StylesRoot.ChartTemplates[chartLayoutType].Height * 1000);
options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionCCITT4;

Image chartImage = _xlsChart.ToImage(options);
AddImage(ImageLayoutTemplateTypes.RelativeToCursorForeGround, chartImage);

}

I’ve tried setting the TiffCompression, changing the resolution, setting the image format to Emf, setting the Quality property, but nothing seems to help. It’s almost as if the ToImage method does not take these properties into account.

Am I missing something?

Hi,

Please download and try the latest version:
Aspose.Cells
for .NET v7.1.2.2

it should fix your problems. Please let us know your feedback.

If the problem still occurs, then please provide us your source xls/xlsx file containing your chart. We will look into it and help you asap.

Hi,

I have exactly the same problem: ImageOrPrintOptions are completely ignored when transforming a chart into image.

I attached a quick project sample and the images created with it (using Aspose.Cells v7.1.2.2). Neither .emf or the .tif doesn’t have an acceptable resolution (96 dpi and text is blurred).

How we should use these saving options?

Thank you

Updating to the new assemblies did not resolve the issue.


I was unable to produce my pie chart in Excel, as the XML gave an error and the chart was removed from the spreadsheet. The pie chart in the attached document is therefore not produced by Aspose. However, I’m not convinced that the source of the chart would affect the ToImage functionality.

Unfortunately, I’m very busy with fixing bugs right now, and won’t be able to produce a test application for the time being. (We’re using a wrapper class for ASPOSE, which makes it rather time consuming to find all the ASPOSE calls we’re making) I’ll get to that as soon as I have a moment available.

Hi,

Thanks for your posting.

I have generated the following image using your xlsx file with the latest version:
Aspose.Cells
for .NET v7.1.2.3



Please see the code below for a reference.

I have requested the development team to look into this issue, how to improve its quality, it should look like Ms-Excel.

We have logged this issue in our database. We will look into it and once, we will get some fix or update, we will let you know asap.

This issue has been logged as CELLSNET-40511.

C#


String filePath = “F:\Shak-Data-RW\Downloads\Pie+excel.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[0];


Chart chart = worksheet.Charts[0];


Bitmap bmp = chart.ToImage();


bmp.Save(filePath + “.out.png”, ImageFormat.Png);


Thanks.


I’ve looked at some of the previous versions of my generated charts (attached to an earlier post in this thread dated 05-04-2011, 12:01 PM ) and those looked a lot smoother. My guess is that the code that doing the smoothing of the edges was accidently removed in a later version of the ASPOSE.Cells assemblies. Hope this helps.

Regards

Hi


I trust that you’re treating this as a critical priority bug, as this is a high profile error on something that did work properly before.

We are releasing in 3 weeks and the client is pressuring us to consider other 3rd party controls to handle the charts in our documents. This is not a desirable option, as it will require major rework and complicate maintenance. However, unless this bug is fixed quickly - preferably within the week - we might have no choice but to consider alternatives.

Regards


Hi,

Thanks for your posting and feedback.

We can understand your needs.

I have logged your comment in our database against the issue id: CELLSNET-40511

Hopefully, your issue will be fixed soon.

Hi,

We are working over your issue at the moment. We will try to provide a fix in 2-3 days hopefully.

Thanks and sorry for any inconvenience caused!
Keep in touch.