//Array of chart objects to be used within render() and setdata() calls.
var chartArray=[{
"type":"bar",
"series":[
{
"values":[11,26,7,44,11]
},
{
"values":[42,13,21,15,33]
},
{
"values":[23,24,13,4,18]
}
]
}];
//Adds an additional chart object to chartArray, and sets data to include new array
function addChart(){
var obj={
"type":"bar",
"series":[
{
"values":[67,53,82,6,9]
},
{
"values":[89,76,52,35,7]
},
{
"values":[98,67,5,34,56]
}
]
};
chartArray.push(obj);
zingchart.exec('divId','setdata',{
data:{"graphset":chartArray}
});
};
//Pops the last object off of the array, but you can choose to remove an object at a specific index
function removeChart(){
chartArray.pop();
zingchart.exec('divId','setdata',{
data:{"graphset":chartArray}
});
};
var data={
"graphset":chartArray
}
$(function(){
zingchart.render({
id : 'divId',
output : 'svg',
width : '100%',
height : 800,
data : data,
autoResize : true
});
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.