HTMLcopy
1
<button onclick="removeRow()">Remove First Row</button>
2
<button onclick="removeRows()">Remove 28-31 Dec</button>
3
<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 a data table
4
dataTable = anychart.data.table(0);
5
6
// add data
7
dataTable.addData([
8
["2015-12-25", 512.53, 514.88, 505.69, 507.34],
9
["2015-12-26", 511.83, 514.98, 505.59, 506.23],
10
["2015-12-27", 511.22, 515.30, 505.49, 506.47],
11
["2015-12-28", 510.35, 515.72, 505.23, 505.80],
12
["2015-12-29", 510.53, 515.86, 505.38, 508.25],
13
["2015-12-30", 511.43, 515.98, 505.66, 507.45],
14
["2015-12-31", 511.50, 515.33, 505.99, 507.98],
15
["2016-01-01", 511.32, 514.29, 505.99, 506.37],
16
["2016-01-02", 511.70, 514.87, 506.18, 506.75]
17
]);
18
19
// map the data
20
var mapping = dataTable.mapAs({open: 1, high: 2, low: 3, close: 4});
21
22
// create a stock chart
23
var chart = anychart.stock();
24
25
// create a plot and an ohlc series
26
var ohlcSeries = chart.plot(0).ohlc(mapping);
27
ohlcSeries.name("ACME Corp.");
28
29
// configure the x-scale
30
chart.xScale("scatter");
31
32
// set the chart title
33
chart.title("Table Data: Removing");
34
35
// set the container id
36
chart.container("container");
37
38
// initiate drawing the chart
39
chart.draw();
40
});
41
42
// remove the first row
43
function removeRow() {
44
dataTable.removeFirst(1);
45
}
46
47
// remove several rows
48
function removeRows() {
49
dataTable.remove("2015-12-28", "2015-12-31");
50
}