Reference > Methods > RenderSvg Method

SharpPlot.RenderSvg Method

Return completed chart rendered through SVG engine.

Example

string mysvg = sp.RenderSvg(SvgMode.FixedAspect);

Return Value

The result of this call is a string representation of an SVG document. This may be written to file as text for inclusion in a webpage, or returned via HTTP with content type “image/svg+xml”. It requires the free SVG plugin from Adobe for display in IE, but will display native in Firefox.

Overloads

Working with SVG

Typically, you would return the SVG directly to the browser, but you may save a stand-alone text file with a simple fragment of C# code such as:

   // Render to SVG file as ASCII
    StreamWriter sw = new StreamWriter("Simple.svg",false,System.Text.Encoding.ASCII);
    string chart = sp.RenderSvg(SvgMode.FixedAspect);
    sw.Write(chart);
    sw.Close();

This file will open in FireFox or Internet Explorer (with the Adobe plugin) and the graphic will scale to give you the best fit in the browser window.

See also ...

SharpPlot Members | SaveSvg Method


Send comments on this topic
© Dyalog Ltd 2013