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
29
1
anychart.onDocumentReady(function () {
2
3
// data
4
var data = [
5
{x: "Men", value: 50.3, info: "<br><i>For every 100<br/>girls, 105 boys are<br/>born, but males<br/>have a higher risk<br/>of dying than<br/>females, both in<br/>childhood and at<br/>adult ages.</i>"},
6
{x: "Women", value: 49.7, info: "<br>The number of<br/>men and women<br/>in the world is<br/>roughly equal,<br/>though men hold<br/>a slight lead with<br/>101 men for 100<br/>women."}
7
];
8
9
// set data
10
var chart = anychart.pie(data);
11
12
// set chart labels
13
var labels = chart.labels();
14
labels.enabled(true);
15
labels.fontColor("black");
16
labels.fontWeight(400);
17
labels.width(140);
18
labels.hAlign("center");
19
labels.position("outside");
20
labels.useHtml(true);
21
labels.format("<span style='text-decoration: underline; font-weight: 900;'>{%x} - {%value}%</span>{%info}");
22
23
// set title
24
chart.title("HTML Text Formatting Sample");
25
26
// draw
27
chart.container("container");
28
chart.draw();
29
});