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.pie([
3
{x: 'Chrome', value: 8},
4
{x: 'Firefox', value: 7},
5
{x: 'Safari', value: 3},
6
{x: 'IE', value: 2}
7
]);
8
9
// Set items formatter.
10
var legend = chart.legend();
11
legend.itemsFormatter(function () {
12
return [
13
{text: 'first', iconFill: '#2196F3', iconType: 'circle'},
14
{text: 'second', iconFill: '#F44336'},
15
{text: 'third', iconFill: '#4CAF50', iconType: 'circle'},
16
{text: 'fourth', iconFill: '#FFEB3B'}
17
]
18
});
19
20
chart.title('Set items formatter');
21
chart.container('container');
22
chart.draw();
23
});