ChartAct / web /AnyChart /pie /chart_0050_pie.html
wumumu's picture
Add files using upload-large-folder tool
7b52e07 verified
Raw History Blame Contribute Delete
7 kB
<!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>