-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript-pie.js
65 lines (56 loc) · 1.61 KB
/
script-pie.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
am4core.ready(function() {
// Themes begin
am4core.useTheme(am4themes_dataviz);
am4core.useTheme(am4themes_animated);
// Themes end
var chart = am4core.create("chartdiv-pie", am4charts.PieChart3D);
// chart.responsive.enabled = true;
// chart.responsive.rules.push({
// relevant: function(target) {
// if (target.pixelWidth <= 400) {
// return true;
// }
// return false;
// }
// });
chart.hiddenState.properties.opacity = 0; // this creates initial fade-in
chart.hiddenState.properties.angle = -90; // rotate on initial load
// chart.legend = new am4charts.Legend();
chart.data = [
{
country: "Lithuania",
litres: 501.9
// "pulled": true
},
{
country: "Czech Republic",
litres: 301.9
},
{
country: "Ireland",
litres: 201.1
},
{
country: "Germany",
litres: 165.8
},
{
country: "Australia",
litres: 139.9
},
{
country: "Austria",
litres: 128.3
}
];
chart.innerRadius = 135;
var series = chart.series.push(new am4charts.PieSeries3D());
series.dataFields.value = "litres";
series.dataFields.category = "country";
series.labels.template.bent = true;
series.labels.template.radius = 25;
series.labels.template.fontSize = "0.75em";
series.ticks.template.disabled = true;
series.alignLabels = false;
// series.slices.template.propertyFields.isActive = "pulled";
}); // end am4core.ready()