[CLOSED] export chart to SVG

Page 3 of 4 FirstFirst 1234 LastLast
  1. #21
    Sencha.IO is set of cloud servies
    http://docs.sencha.io/0.3.2/index.html#!/guide/intro

    To save chart to png using Sencha.IO
    
    App.MyChart.save({  type: 'image/png'});
    it did not work.
    Please provide more details. What symptoms? Errors? If you click on 'Save chart' button in the online sample then a browser should download a png. Is it same for you?
  2. #22
    Yes, it is the same. It is when I used into my application it didn't work.

    I copy/paste the javascript function :

    function saveChart( btn )
    {
        Ext.MessageBox.confirm( 'Confirm Download', 'Would you like to download the chart as an image?', function ( choice )
        {
            if ( choice == 'yes' )
            {
                btn.up( 'panel' ).down( 'chart' ).save( {
                    type: 'image/png'
                } );
            }
        } );
    }
    I will try with the syntax you show.

    I go to see what is Sencha.IO. Do I need to create a login for me?
  3. #23
    It is when I used into my application it didn't work.
    Is your application intranet? Is request outside your domain allowed?
    Try to run Fiddler and investigate result of generated requests. You can compare with requests are generated by the online sample
  4. #24
    Wow, I'm suprised, it works...One more question: could I use this solution as a long term one or will it be breaked in the future?
  5. #25
    Well, I cannot say anything concrete because it is Sencha service, only they can answer on thsi question
    'save' method is part of ExtJS framework therefore I suppose it must be supported while ExtJS toolkit has support
  6. #26
    OK, thanks, I will try to make svg.dll works too, this way, I will have 2 solutions.
  7. #27
    I also have that SVG project from codeplex source and included that in my solution. I think it would work far better if you do not depend on 3rd party for the conversion.... However the SVG project is a bit old and had a few bugs that I've fixed from the source code. A lot of people uploaded patches but they didn't seem to consolidate all of them and make it a release. Anyway it works.
  8. #28
    Totaly agreed with you, but on my own, I didn't manage to even get a workable object from that function (svgGraph is set to null after call) :

    svgGraph = Svg.SvgDocument.Open(xd)
    So is it a bug or something I didn't understand?
  9. #29
    Is your xd a valid XmlDocument?

    I created this util function, may be it will help.

    The parameter SVGDoc is the SVG string generated from the clientside script

     public class SVGUtil
        {
            public static void SavePNG(Stream SaveStream, string SVGDoc){
    
                XmlDocument xd = new XmlDocument();
                xd.XmlResolver = null;
                xd.LoadXml(SVGDoc);
                var svgGraph = Svg.SvgDocument.Open(xd);
    
                svgGraph.Draw().Save(SaveStream, System.Drawing.Imaging.ImageFormat.Png);
              
            }
        }
  10. #30
    Hello CarpFisher

    I already addapt your function like that :

     Private Sub SavePNG(ByRef SaveStream As Stream, ByVal SVGDoc As String)
    
            Dim xd As New XmlDocument()
            xd.XmlResolver = Nothing
            xd.LoadXml(SVGDoc)
            Dim svgGraph As SvgDocument = New SvgDocument
    
            svgGraph = Svg.SvgDocument.Open(xd)
    
            svgGraph.Draw.Save("c:\test.png")
            'svgGraph.Draw().Save(SaveStream, System.Drawing.Imaging.ImageFormat.Png)
    
        End Sub
    the problem is on that line :
      svgGraph = Svg.SvgDocument.Open(xd)
    In return, svgGrapg is set to null. I have something in SVGDoc, is this something good, I think so, because using Sencha.IO, works. Here, how I get SVGDoc:

    App.direct.SaveCharts( chart ,Ext.draw.engine.SvgExporter.self.generate(null, Ext.getCmp(chart).surface));
    chart is the name of the chart I want to save. I debug it in javascrip, and Ext.getCmp(chart).surface give an object.

    Could you give me your modified dll, I could see if the problem is in the dll I get, please?
Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. [CLOSED] Export Chart as Image
    By jchau in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Feb 28, 2014, 5:14 AM
  2. [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
  3. Replies: 2
    Last Post: Aug 13, 2012, 2:12 PM
  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