Adding
0
20
40
60
80
100
'02
'03
'04
'05
'06
'07
'08
'09
'10
'11
20
55
40
78
61
35
80
50
65
59
<script src="../../codebase/dhtmlxchart.js" type="text/javascript"></script> <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxchart.css"> <script src="../common/testdata.js"></script> <script></script> <div id="chartDiv" style="width:800px;height:250px;border:1px solid #A4BED4;"></div> <input type="button" value="add" onclick="addNew()"> <input type="button" value="delete" onclick="deleteFirst()">var barChart1; window.onload = function() { barChart1 = new dhtmlXChart({ view: "bar", container: "chartDiv", value: "#sales#", label: "#sales#", gradient: "rising", width: 50, radius: 2, tooltip: { template: "#sales#"; }, yAxis: { start: 0, end: 100, step: 10, template: function(value) { return value % 20 ? "": value; } }, xAxis: { template: "'#year#"; } }); barChart1.parse(dataset, "json"); }; var counter = 12; function addNew() { barChart1.add({ year: counter, sales: parseInt(Math.random() * 100, 10); }); counter++; } function deleteFirst() { barChart1.remove(barChart1.first()); }