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 data
4
var data = [
5
{x: "John", value: 5000},
6
{x: "Richard", value: 5000},
7
{x: "Larry", value: 5000},
8
{x: "Marta", value: 15000, legendItem: {
9
fontColor: "#455a64",
10
fontSize: 30,
11
fontWeight: 600,
12
iconType: "circle",
13
iconSize: 50,
14
iconStroke: "4 #455a64",
15
iconHatchFill: {
16
type: "forward-diagonal",
17
color: "#455a64",
18
thickness: 4,
19
size: 8
20
}
21
}}
22
];
23
24
// create a chart and set the data
25
chart = anychart.pie(data);
26
27
// set the layout of the legend
28
chart.legend().itemsLayout("vertical");
29
30
// set the position of the legend
31
chart.legend().position("right");
32
33
// set the chart title
34
chart.title("Individual Legend Items: Single Series");
35
36
// set the container id
37
chart.container("container");
38
39
// initiate drawing the chart
40
chart.draw();
41
});