HTMLcopy
1
<div id="container"></div>
CSScopy
8
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
24
1
anychart.onDocumentReady(function() {
2
// set output locale
3
anychart.format.outputLocale('es-es');
4
// create some data
5
var data = [
6
[Date.UTC(2016, 0, 1), 3],
7
[Date.UTC(2016, 2, 1), 5],
8
[Date.UTC(2016, 11, 1), 2]
9
];
10
// create line chart
11
chart = anychart.line(data);
12
// set x-axis labels formatter
13
chart.xAxis(0).labels().format(function() {
14
return anychart.format.dateTime(this.value);
15
});
16
// set tooltip title formatter
17
chart.tooltip().titleFormat(function() {
18
return anychart.format.dateTime(this.x);
19
});
20
// set container id for the chart
21
chart.container('container');
22
// initiate chart drawing
23
chart.draw();
24
});