[CLOSED] Using SVG library for saving chart images

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Using SVG library for saving chart images

    Glad that the thread below was posted and that you gave an example.

    Thread #1 - Exporting 2 Charts into Single png

    It provided a work around to an issue that I have had for several months.

    Thread #2 - Using SVG [Post #7 an beyond]

    The issue is the background image of the Ext.NET chart is not being captured and thus when using the SVG library the background is grey. If you add the following button and method to the thread #1 example you will see what I mean.

    ...
    [DirectMethod]
    public void SaveSvgChart1Only(string svg1)     {
       XmlDocument xd = new XmlDocument();
       xd.XmlResolver = null;
       xd.LoadXml(Server.HtmlDecode(svg1));
       var svgGraph = Svg.SvgDocument.Open(xd);
       svgGraph.Draw().Save(@"c:\\testChar1Only.png", System.Drawing.Imaging.ImageFormat.Png);
    } 
    ...
    <ext:Button
         runat="server" 
         Text="Save SVG Chart #1"
         Handler="var svg1 = Ext.htmlEncode(Ext.draw.engine.SvgExporter.generate(#{Chart1}.surface)); #{DirectMethods}.SaveSvgChart1Only(svg1);" />
    So for a work around I perform the same steps you did in the example for saving just one chart and clear the canvas to white.

    If in your example Chart #1 had
    StyleSpec="background: yellow;"
    how would you save the chart via SVG so that it looked the same as what is on the screen?
    Last edited by Daniil; Nov 26, 2013 at 12:42 PM. Reason: [CLOSED]
  2. #2
    Hello!

    You should use Background property because when you use StyleSpec it doesn't go to SVG, it stays only in browser:

    <ext:Chart
    	ID="Chart1"
    	runat="server"
    	Width="400"
    	Height="400">
    	<Background Fill="#FFFF00" />
  3. #3
    Very cool. To many attributes everywhere. I think I have graduated to 8th grade in understanding things, and you throw me back to 3rd grade.

    Please close the thread.
  4. #4
    I have the same feelings sometimes when I'm talking with Daniil :)
  5. #5
    I always have the same feelings talking to Vladimir:)))
  6. #6
    Based on the comment above about StyleSpec attribute vs the Background property would you want to change several of the chart examples from using StyleSpec to Background?

    You do have the 'Save Image' button that produces a PNG for the chart and the background is not white because of using the SytleSpec.

    Chart -> Area -> Basic
    Chart -> Area -> Browser_Stats
    Chart -> Bar -> Grouped
    Chart -> Bar -> Mixed
    Chart -> Bar -> Renderer

    Plus many others ...
    Last edited by cwolcott; Nov 25, 2013 at 10:23 AM.

Similar Threads

  1. [CLOSED] Saving chart to svg
    By JCarlosF in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 27, 2013, 1:29 AM
  2. did Chart Support 3-D images?
    By jforce in forum 2.x Help
    Replies: 1
    Last Post: Dec 17, 2012, 7:27 PM
  3. Upgrade Ext.net library version
    By xMAC in forum 1.x Help
    Replies: 1
    Last Post: Jul 13, 2012, 8:15 PM
  4. Ext.net library with mvc3
    By Neha in forum 2.x Help
    Replies: 0
    Last Post: May 11, 2012, 9:02 AM
  5. Replies: 2
    Last Post: Apr 14, 2011, 9:03 AM

Posting Permissions