[CLOSED] Using SVG library for saving chart images

Page 1 of 2 12 LastLast
  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.

    public void SaveSvgChart1Only(string svg1)     {
       XmlDocument xd = new XmlDocument();
       xd.XmlResolver = null;
       var svgGraph = Svg.SvgDocument.Open(xd);
       svgGraph.Draw().Save(@"c:\\testChar1Only.png", System.Drawing.Imaging.ImageFormat.Png);
         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

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

    	<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.
  7. #7
    Thank you for that catch. But... let's imagine it was done intentionally, i.e. a user doesn't need that background to go with a chart on saving;)
  8. #8
    That is fine. The reason I had an issue was as a newbie to Ext.NET I looked at the examples and used StyleSpec to color my chart backgrounds (Like the example) and didn't look further for an additional property in Chart. Thus when I went to use SVG I didn't understand why the background was not being picked up by SVG.

    Obviously the error was mine for not using <Background Fill="white">, but in your examples you were using StyleSpec and had a button to "Save Image" so I thought I was good.

    Not a problem. It is just what I experienced 6 months ago when I was integrating SVG into my charts.
  9. #9
    Fair enough. Sorry that our examples misled you in that case.
  10. #10
    I'm agree with @Daniil, but we will add new samples with SVG where we will take into account your note about background.
Page 1 of 2 12 LastLast

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