HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
var chart = anychart.bar([
3
{x: 'Meat', value: 10},
4
{x: 'Fruit', value: 12},
5
{x: 'Nuts', value: 18},
6
{x: 'Milk', value: 11},
7
{x: 'Fish', value: 9}
8
]);
9
10
var series = chart.getSeries(0);
11
series.selected({fill: '#4CAF50'});
12
series.select([1, 3]);
13
14
chart.listen('chartDraw', function () {
15
16
// Get selected points.
17
var points = chart.getSelectedPoints();
18
19
var point = points[0];
20
return point.selected(false);
21
});
22
23
chart.title('Get an array of the selected points and modify the point');
24
chart.container('container');
25
chart.draw();
26
});