Nov 21, 2013, 1:58 PM
[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.
If in your example Chart #1 had
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]