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.line();
3
4
var firstSeries = chart.line([
5
{x: 0, value: 22},
6
{x: 1, value: 34},
7
{x: 2, value: 16},
8
{x: 3, value: 12},
9
{x: 4, value: 41},
10
{x: 5, value: 47}
11
]);
12
13
chart.line([
14
{x: 0, value: 39},
15
{x: 1, value: 28},
16
{x: 2, value: 21},
17
{x: 3, value: 18},
18
{x: 4, value: 24},
19
{x: 5, value: 29}
20
]);
21
22
chart.legend(true);
23
24
var legendItem = firstSeries.legendItem();
25
26
// Set text formatter.
27
legendItem.format(function () {
28
return '[formatted]';
29
});
30
31
chart.title("Set text formatter");
32
chart.container("container");
33
chart.draw();
34
});