HTMLcopy
1
<fieldset>
2
<legend>Distribute series by</legend>
3
<label><input onclick="chart.categorizedBySeries(true)" type="radio" name="mode" checked>Series Names</label>
4
<label><input onclick="chart.categorizedBySeries(false)" type="radio" name="mode">Point Names</label>
5
</fieldset>
6
<div id="container"></div>
CSScopy
20
1
html, body {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
7
#container {
8
position: absolute;
9
width: 100%;
10
top: 55px;
11
bottom: 0;
12
}
13
fieldset {
14
font-family: Verdana;
15
font-size: 13px;
16
border: none;
17
}
18
input, label {
19
cursor: pointer;
20
}
JavaScriptcopy
x
1
var chart;
2
anychart.onDocumentReady(function() {
3
chart = anychart.column();
4
chart.data({
5
header: ['#', 'Oil', 'Gas', 'Gasoline', 'Diesel fuel'],
6
rows: [
7
['2013', 21, 99, 19, 72],
8
['2014', 41, 7, 71, 10],
9
['2015', 9, 15, 77, 58],
10
['2016', 71, 34, 40, 21],
11
['2017', 6, 29, 11, 46]
12
]
13
});
14
15
// Distribute series by series names or point names
16
// true: by series names
17
// false: by point names
18
chart.categorizedBySeries(true);
19
20
chart.legend().enabled(true).position('bottom');
21
chart.container('container');
22
chart.draw();
23
});