FusionCharts API-Methods: getSVGSting
Created using FusionCharts Suite XT - www.fusioncharts.com
by FusionCharts
HTML
<script src="https://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="https://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<!-- This sample shows usage of the getSVGString() method -->
<div id="indicatorDiv">Method Name: <strong>getSVGString()</strong>
<p>Fetches the SVG of a chart, created by FusionCharts while rendering the chart, as a string. This function can be called only after the chart has rendered.</p>
<p>Click <strong>Get SVG String</strong> to get the chart SVG string.</p>
<div class="text-center">
<button id="get">Get SVG String</button>
<div id="text" >The chart SVG string is given below:
<div id="msg" align="left"></div>
</div>
<div id="chart-container">FusionCharts will render here</div>
</div>
</div>
CSS
body {
padding: 5px;
margin: 0 auto;
}
strong{
font-weight: bold;
}
.text-center {
text-align: center;
}
p {
margin: 10px auto;
}
.mb-20 {
margin-bottom: 20px;
}
#indicatorDiv {
width: 500px;
font-family:'Arial', 'Helvetica';
font-size: 13px;
}
.container {
float:left;
}
#msg {
overflow:auto;
margin: 20px 0;
}
#text {
font-family:'Arial', 'Helvetica';
font-size: 13px;
margin: 10px;
}
#get {
font-size: 13px;
padding: 10px 20px;
}
JavaScript
FusionCharts.ready(function () {
var visitChart = new FusionCharts({
type: 'msline',
renderAt: 'chart-container',
width: '450',
height: '350',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Number of visitors last week",
"subCaption": "Bakersfield Central vs Los Angeles Topanga",
"theme": "fint",
"captionFontSize": "13",
"subcaptionFontSize": "12"
},
"categories": [{
"category": [{
"label": "Mon"
}, {
"label": "Tue"
}, {
"label": "Wed"
}, {
"vline": "true",
"lineposition": "0",
"color": "#6baa01",
"labelHAlign": "center",
"labelPosition": "0",
"label": "National holiday",
"dashed": "1"
}, {
"label": "Thu"
}, {
"label": "Fri"
}, {
"label": "Sat"
}, {
"label": "Sun"
}]
}],
"dataset": [{
"seriesname": "Bakersfield Central",
"data": [{
"value": "15123"
}, {
"value": "14233"
}, {
"value": "25507"
}, {
"value": "9110"
}, {
"value": "15529"
}, {
"value": "20803"
}, {
"value": "19202"
}]
}, {
"seriesname": "Los Angeles Topanga",
"data": [{
"value": "13400"
...