File size: 6,998 Bytes
7b52e07 | 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>quick start pie</title>
<link href="https://playground.anychart.com/G7aIFSQd/iframe" rel="canonical">
<meta content="Circle Chart,Pie Chart,Polar Chart,Tooltip" name="keywords">
<meta content="AnyChart - JavaScript Charts designed to be embedded and integrated" name="description">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link href="_deps/cdn.anychart.com/releases/8.11.1/css/anychart-ui.min_qe95e7e741b.css" rel="stylesheet" type="text/css">
<style>html,
body,
#container {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
button {
margin: 10px 0 0 10px;
}</style>
</head>
<body>
<button id="overall">Industry summary</button>
<button id="alignment">Alignment</button>
<button id="cost">Cost</button>
<button id="efficiency">Efficiency</button>
<div id="container"></div>
<script src="_deps/cdn.anychart.com/releases/8.11.1/js/anychart-base.min_qe95e7e741b.js"></script>
<script src="_deps/cdn.anychart.com/releases/8.11.1/js/anychart-exports.min_qe95e7e741b.js"></script>
<script src="_deps/cdn.anychart.com/releases/8.11.1/js/anychart-ui.min_qe95e7e741b.js"></script>
<script src="_deps/cdn.anychart.com/releases/8.11.1/js/anychart-polar.min.js"></script>
<script type="text/javascript">//create data for Summary
var summData1 = [
{x: "Alignment", value: 4.8},
{x: "Costs", value: 4.4},
{x: "Efficiency", value: 4.5},
{x: "Overall", value: 4.6},
];
var summData2 = [
{x: "Alignment", value: 4.3},
{x: "Costs", value: 3.3},
{x: "Efficiency", value: 4.6},
{x: "Overall", value: 4.2},
];
var summData3 = [
{x: "Alignment", value: 4.2},
{x: "Costs", value: 2.9},
{x: "Efficiency", value: 4.3},
{x: "Overall", value: 4.0},
];
//create data for Cost
var costData1 = [
{x: "Aggregate costs", value: 4.3},
{x: "Cost structure and transparency", value: 4.4},
];
var costData2 = [
{x: "Aggregate costs", value: 2.8},
{x: "Cost structure and transparency", value: 3.7},
];
var costData3 = [
{x: "Aggregate costs", value: 2.8},
{x: "Cost structure and transparency", value: 3},
];
//create data for Efficiency
var effData1 = [
{x: "AO organisational effectiveness", value: 5.1},
{x: "AM organisational effectiveness", value: 5.4},
{x: "Long-term effectiveness/sustainability", value: 3.7},
{x: "Value chain effectiveness", value: 3.7},
{x: "Effective regulation", value: 4.4},
];
var effData2 = [
{x: "AO organisational effectiveness", value: 4.4},
{x: "AM organisational effectiveness", value: 5.8},
{x: "Long-term effectiveness/sustainability", value: 3.9},
{x: "Value chain effectiveness", value: 3.8},
{x: "Effective regulation", value: 5},
];
var effData3 = [
{x: "AO organisational effectiveness", value: 3.9},
{x: "AM organisational effectiveness", value: 5.8},
{x: "Long-term effectiveness/sustainability", value: 3.8},
{x: "Value chain effectiveness", value: 3.5},
{x: "Effective regulation", value: 4.4},
];
//create data for Alignment
var alignData1 = [
{ x: 'Trust measures', value: 5.2},
{ x: 'Transparency', value: 5},
{ x: 'Ethical condition', value: 5.6},
{ x: 'Incentives structure', value: 4.4},
{ x: 'Culture', value: 4.9},
{ x: 'Society', value: 3.9}
];
var alignData2 = [
{ x: 'Trust measures', value: 4},
{ x: 'Transparency', value: 4.3},
{ x: 'Ethical condition', value: 5.2},
{ x: 'Incentives structure', value: 3.7},
{ x: 'Culture', value: 4.6},
{ x: 'Society', value: 3.9}
];
var alignData3 = [
{ x: 'Trust measures', value: 4.4},
{ x: 'Transparency', value: 4.2},
{ x: 'Ethical condition', value: 5},
{ x: 'Incentives structure', value: 3.5},
{ x: 'Culture', value: 4},
{ x: 'Society', value: 0}
];
anychart.onDocumentReady(function () {
// create polar chart
var chart = anychart.polar();
var columnSeries1 = chart.column(alignData1);
// set series name
columnSeries1.name('2023');
var columnSeries2 = chart.column(alignData2);
// set series name
columnSeries2.name('2018');
var columnSeries3 = chart.column(alignData3);
// set series name
columnSeries3.name('2015');
// adjust chart settings
var title = chart.title();
// enable title
title.enabled(true);
// set padding
title.padding(5);
// set title text
title.text("Investment industry scorecard");
title.fontSize(20).fontColor('black');
// settings for title background
var titleBackground = chart.title().background();
// enable background
titleBackground.enabled(true);
// set background inner color
titleBackground.fill("#FFD700");
// set background border
titleBackground.stroke("#D8D8D8");
// set type of background corners
titleBackground.cornerType("round");
// set corners size
titleBackground.corners(10);
// enable sorting points by x
chart.sortPointsByX(true);
// disable y-axis
chart.yAxis(false);
// set value prefix for tooltip
chart.tooltip().valuePrefix('Score:');
// set x-scale
chart.xScale('ordinal');
// set chart container id
chart.container('container');
// create the legend
chart.legend().enabled(true).itemsLayout('vertical').position('right').fontColor('black');
// configure the chart labels
var labels = chart.xAxis().labels();
labels.fontSize(20)
.fontColor('black');
// customize the series color
columnSeries1.color('#83B8AE');
columnSeries2.color('#DC911B');
columnSeries3.color('#DDD65A');
chart.padding(50, 0, 0, 0);
// initiate chart drawing
chart.draw();
//function for switching to "Industry summary"
var summary = function(){
columnSeries1.data(summData1);
columnSeries2.data(summData2);
columnSeries3.data(summData3);
}
//function for switching to "Alignment"
var alignment = function(){
columnSeries1.data(alignData1);
columnSeries2.data(alignData2);
columnSeries3.data(alignData3);
}
//function for switching to "Cost"
var cost = function(){
columnSeries1.data(costData1);
columnSeries2.data(costData2);
columnSeries3.data(costData3);
}
//function for switching to "Efficiency"
var efficiency = function(){
columnSeries1.data(effData1);
columnSeries2.data(effData2);
columnSeries3.data(effData3);
}
//register a click on an button and fire according function
document.getElementById("overall").addEventListener("click", summary);
document.getElementById("alignment").addEventListener("click", alignment);
document.getElementById("cost").addEventListener("click", cost)
document.getElementById("efficiency").addEventListener("click", efficiency)
});
</script>
</body>
</html> |