[CLOSED] Export Chart as Image

  1. #1

    [CLOSED] Export Chart as Image

    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.
    Last edited by Daniil; Aug 01, 2013 at 3:48 AM. Reason: [CLOSED]
  2. #2
    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
  3. #3
    For example, try this library
    http://svg.codeplex.com/

    Here is sample code
    http://svg.codeplex.com/discussions/249858
  4. #4
    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.LegendPosition.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
  5. #5
    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?
  6. #6
    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.LegendPosition.Right))
                              .StyleSpec("background:#fff;")
                              .Store(pieChartStore)
                              .Series(pieChartSeries);
    Regards,
    Chinni
  7. #7
  8. #8
    We have created our own endpoint as an alternative of "svg.sencha.io". More details are here:
    forums.ext.net/showthread.php?28195

Similar Threads

  1. [CLOSED] How to Export SVG chart from code behind
    By feanor91 in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 27, 2013, 6:20 AM
  2. Replies: 2
    Last Post: Aug 13, 2012, 2:12 PM
  3. [CLOSED] export chart to SVG
    By CarpFisher in forum 2.x Legacy Premium Help
    Replies: 30
    Last Post: Jun 07, 2012, 7:49 AM
  4. Replies: 1
    Last Post: Jun 02, 2012, 7:12 AM
  5. Replies: 1
    Last Post: Apr 19, 2010, 2:44 PM

Tags for this Thread

Posting Permissions