var chartModel = new ZingChart.ZingChartModel({
json: {
type: "bar",
series: [
{
values: [3,2,3,3,9]
},
{
values: [1,2,3,4,5]
}
]
},
width: 500,
height: 400
});
var chartView = new ZingChart.ZingChartView({
model: chartModel,
el: $("#chart")
});
chartView.render();
var newJson = {
type: "line",
series: [
{
values: [1,1,2,3,5,8,13]
}
]
};
$("#change").click(function(){
chartModel.set('json', newJson);
});
External resources loaded into this fiddle:
<div id="chart"></div>
<button id="change">Set JSON</button>