PDA

View Full Version : [CLOSED] Export Chart as Image



jchau
Apr 07, 2012, 3:29 PM
Is it possibble to export chart as an image from the server side or client side? We have a requirement to be able to export charts to pdf.

Vladimir
Apr 07, 2012, 8:49 PM
Hi,

There is save method in Chart widget


chart.save({
type: 'image/png'
});


It converts chart to SVG string, sends it to http://svg.sencha.io/ and you receive an image in the response
Also you can get SVG string manually


var svgString = Ext.draw.engine.SvgExporter.self.generate({}, chartCmp.surface);


and sends it to the server. I believe that there are libraries are able to convert SVG to PDF or image

Vladimir
Apr 07, 2012, 8:52 PM
For example, try this library
http://svg.codeplex.com/

Here is sample code
http://svg.codeplex.com/discussions/249858

chinninani
Jul 26, 2013, 1:57 PM
Hi Vladimir,

Thanks for quick response.

I am using below chart to display pie chart.


var pieChart = X.Chart()
.ID("pieChart")
.Animate(true)
.AutoShow(true)
.Shadow(true)
.InsetPadding(60)
.LegendConfig(X.ChartLegend().Position(Ext.Net.Leg endPosition.Right))
.StyleSpec("background:#fff;")
.Store(pieChartStore)
.Series(pieChartSeries);

I have store and series also. But in mvc.ext.net i didi't find any sample to export pie chart in pdf.

I have one button below pie chart. when we click on that button i want to take export that image in pdf.

Regards,
chinni

Baidaly
Jul 26, 2013, 11:53 PM
Hello!

Ext.NET can generate only image of your chart. You should upload it and use some server-side tools to create PDF with the chart image like this one: http://sourceforge.net/projects/itextsharp/

What tools do use? And what is your scenario?

chinninani
Jul 27, 2013, 8:47 AM
Thanks you all for quick response.


Can anyone please let me know how can i save pie chart to image file.

For below pie chart object i didn't find that save option.

Save option:


chart.save({
type: 'image/png'
});

var pieChart = X.Chart()
.ID("pieChart")
.Animate(true)
.AutoShow(true)
.Shadow(true)
.InsetPadding(60)
.LegendConfig(X.ChartLegend().Position(Ext.Net.Leg endPosition.Right))
.StyleSpec("background:#fff;")
.Store(pieChartStore)
.Series(pieChartSeries);

Regards,
Chinni

Baidaly
Jul 28, 2013, 12:25 AM
Please, read the following threads:

http://forums.ext.net/showthread.php?25448
http://forums.ext.net/showthread.php?25553

Daniil
Feb 28, 2014, 6:14 AM
We have created our own endpoint as an alternative of "svg.sencha.io". More details are here:
forums.ext.net/showthread.php?28195