84 lines
2.1 KiB
HTML
84 lines
2.1 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Highcharts Example</title>
|
|
|
|
<style type="text/css">
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script src="../../code/highcharts.js"></script>
|
|
<script src="../../code/modules/exporting.js"></script>
|
|
<script src="../../code/modules/export-data.js"></script>
|
|
|
|
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
// Make monochrome colors
|
|
var pieColors = (function () {
|
|
var colors = [],
|
|
base = Highcharts.getOptions().colors[0],
|
|
i;
|
|
|
|
for (i = 0; i < 10; i += 1) {
|
|
// Start out with a darkened base color (negative brighten), and end
|
|
// up with a much brighter color
|
|
colors.push(Highcharts.Color(base).brighten((i - 3) / 7).get());
|
|
}
|
|
return colors;
|
|
}());
|
|
|
|
// Build the chart
|
|
Highcharts.chart('container', {
|
|
chart: {
|
|
plotBackgroundColor: null,
|
|
plotBorderWidth: null,
|
|
plotShadow: false,
|
|
type: 'pie'
|
|
},
|
|
title: {
|
|
text: 'Browser market shares at a specific website, 2014'
|
|
},
|
|
tooltip: {
|
|
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
|
|
},
|
|
plotOptions: {
|
|
pie: {
|
|
allowPointSelect: true,
|
|
cursor: 'pointer',
|
|
colors: pieColors,
|
|
dataLabels: {
|
|
enabled: true,
|
|
format: '<b>{point.name}</b><br>{point.percentage:.1f} %',
|
|
distance: -50,
|
|
filter: {
|
|
property: 'percentage',
|
|
operator: '>',
|
|
value: 4
|
|
}
|
|
}
|
|
}
|
|
},
|
|
series: [{
|
|
name: 'Share',
|
|
data: [
|
|
{ name: 'Chrome', y: 61.41 },
|
|
{ name: 'Internet Explorer', y: 11.84 },
|
|
{ name: 'Firefox', y: 10.85 },
|
|
{ name: 'Edge', y: 4.67 },
|
|
{ name: 'Safari', y: 4.18 },
|
|
{ name: 'Other', y: 7.05 }
|
|
]
|
|
}]
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|