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
3
// set default icons for legend items
4
// for lines, splines and markers
5
anychart.theme({
6
chart: {
7
defaultSeriesSettings: {
8
line: {legendItem: {iconType: "line"}},
9
spline: {legendItem: {iconType: "spline"}},
10
marker: {legendItem: {iconType: "marker"}}
11
}}});
12
13
// create a chart
14
var chart = anychart.line();
15
// enable legend
16
chart.legend(true);
17
18
// series data
19
var data = anychart.data.set([
20
["John", 1, 3, 2],
21
["Jake", 4, 2, 1],
22
["Pete", 6, 3, 5]
23
]);
24
25
chart.marker(data.mapAs({x: 0, value: 1}));
26
chart.line(data.mapAs({x: 0, value: 2})).markers(true);
27
chart.spline(data.mapAs({x: 0, value: 3})).markers(true);
28
29
// draw chart
30
chart.container("container");
31
chart.draw();
32
});