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
// create a data set
4
var data = anychart.data.set([
5
["January", 10000, 9000],
6
["February", 12000, 10500],
7
["March", 13000, 11000],
8
["April", 10000, 9000],
9
["May", 9000, 8500]
10
]);
11
12
// map the data
13
var seriesData_1 = data.mapAs({x: [0], value: [1]});
14
var seriesData_2 = data.mapAs({x: [0], value: [2]});
15
16
// set the chart type
17
var chart = anychart.line();
18
19
// create the first series and set the data
20
var series1 = chart.line(seriesData_1);
21
22
// create the second series and set the data
23
var series2 = chart.line(seriesData_2);
24
25
// enable and configure markers on the first series
26
series1.markers(true);
27
series1.markers().type("star5");
28
series1.markers().fill("gold");
29
series1.markers().size(10);
30
31
// set the chart title
32
chart.title("Markers (Series)");
33
34
// set the titles of the axes
35
var xAxis = chart.xAxis();
36
xAxis.title("Month");
37
var yAxis = chart.yAxis();
38
yAxis.title("Sales, $");
39
40
// set the container id
41
chart.container("container");
42
43
// initiate drawing the chart
44
chart.draw();
45
});