getJSONData using isRaw
Created using FusionCharts Suite XT - www.fusioncharts.com
by FusionCharts
HTML
<script src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
<!-- Example of getJSONData using isRaw -->
<button id="get">
Get Data
</button>
<div id="msg" class="mb-20"> Chart data will be displayed here.</div>
<div id="chart-container">FusionCharts will render here</div>
JavaScript
FusionCharts.ready(function() {
var topStores = new FusionCharts({
type: 'bar2d',
renderAt: 'chart-container',
width: '500',
height: '400',
dataFormat: 'json',
dataSource: {
"chart": {
"theme": "fusion",
"caption": "Top 5 Stores by Sales",
"subCaption": "Last month",
"yAxisName": "Sales (In USD)",
"numberPrefix": "$",
"alignCaptionWithCanvas": "0"
},
"data": [{
"label": "Bakersfield Central",
"value": "880000",
"myValueInCamelCase":"text"
},
{
"label": "Garden Groove harbour",
"value": "730000"
},
{
"label": "Los Angeles Topanga",
"value": "590000"
},
{
"label": "Compton-Rancho Dom",
"value": "520000"
},
{
"label": "Daly City Serramonte",
"value": "330000"
}
]
}
})
.render();
document.getElementById('get').addEventListener('click',()=>{
data = topStores.getJSONData({ isRaw: 1});
msg.innerHTML = JSON.stringify(data, undefined, 2);
})
});