Exporting To SVG
|
Including SVG Export Functionality To add the SVG Export functionality to your current implementation, simply include the file immediately after the EJSChart.js <head> <script type="text/javascript" src="/EJSChart/EJSChart.js"></script> <script type="text/javascript" src="/EJSChart/EJSChart_SVGExport.js"></script> </head>
Exporting SVG Exporting SVG from your chart is as simple as making a single JavaScript call. The following example shows how to call the exportSVG method and obtain the resulting SVG. The default configuration will produce complete SVG including headers and sized to match the dimensions of source chart. If additional customization is needed, the options parameter allows for settings to be changed at the time of export. <script type="text/javascript">
var chart = new EJSC.Chart("myChart", {}); var series = new EJSC.LineSeries( new EJSC.ArrayDataHandler([[1,1],[2,2],[3,3],[4,2],[5,1]]), {} ); chart.addSeries(series);
function buttonClick() { alert(chart.exportSVG()); }
</script> <button onclick="buttonClick();">Export SVG</button> |