HTMLcopy
1
<button id="removeButton" onclick="removeRow()">Remove Last Row</button>
2
<div id="container"></div>
CSScopy
15
1
html, body {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
7
button {
8
margin: 10px 0 0 10px;
9
}
10
#container {
11
position: absolute;
12
width: 100%;
13
top: 35px;
14
bottom: 0;
15
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// create data
4
data = [
5
["January", 12000],
6
["February", 15000],
7
["March", 16000],
8
["April", 14000],
9
["May", 10000]
10
];
11
12
// create a data set
13
dataSet = anychart.data.set(data);
14
15
// map the data
16
var mapping = dataSet.mapAs({x: 0, value: 1});
17
18
// create a chart
19
var chart = anychart.column();
20
21
// create a series and set the data
22
var series = chart.column(mapping);
23
// set the chart title
24
chart.title("Data Sets: Removing");
25
26
// set the container id
27
chart.container("container");
28
29
// initiate drawing the chart
30
chart.draw();
31
});
32
33
// remove the last row
34
function removeRow() {
35
dataSet.remove(dataSet.getRowsCount() - 1);
36
}