Reference > Methods > SaveXaml Method

SharpPlot.SaveXaml Method

This method saves the chart expressed as a XAML Canvas, with optional scaling. The default scale converts points to pixels at 96/72 and will produce the same size image as the chart rendered to SVG. The chart can be viewed on the web in most common browsers with the SilverLight plugin.

If the extension is ‘.xaml’ the canvas is saved exactly as rendered. If it is ‘.htm’ or ‘.html’ the xaml block is wrapped in script tags and included in a stand-alone webpage which will load directly into the browser. This is very convenient for initial testing, but you will probably want to make your own wrapper page for production use.

Example

sp.SaveXaml(path + "foo.html",2);  // Save as script with htm wrapper
sp.SaveXaml(path + "foo.xaml");    // Save as bare Canvas for inclusion

Overloads

Description

To make use of this format on the internet, you will need the SilverLight plugin from Microsoft, and an appropriate ‘wrapper’ HTML page to load the plugin and render the XAML content.

Your page should reference the silverlight.js file supplied with the plugin, and also the silverplot.js file supplied with SharpPlot which adds support for hints, tips and hyperlinks to your charts. Use the wrapper page as a guide for the correct formatting.

See also ...

SharpPlot Members | RenderXaml Method | The SilverLight Plugin


Send comments on this topic
© Dyalog Ltd 2013