mirror of https://github.com/zieckey/gochart.git
79 lines
2.7 KiB
Go
79 lines
2.7 KiB
Go
|
package main
|
||
|
|
||
|
// see the resource of : http://www.freecdn.cn/libs/highcharts/
|
||
|
|
||
|
var PieHtml = `{{define "T"}}
|
||
|
<!DOCTYPE HTML>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<title>Highcharts Example</title>
|
||
|
|
||
|
<script type="text/javascript" src="http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
$(function () {
|
||
|
$('#container').highcharts({
|
||
|
chart: {
|
||
|
//type: 'pie',
|
||
|
type: '{{.ChartType}}',
|
||
|
plotBackgroundColor: null,
|
||
|
plotBorderWidth: null,
|
||
|
plotShadow: false
|
||
|
},
|
||
|
title: {
|
||
|
// text: 'Browser market shares at a specific website, 2014'
|
||
|
text: '{{.Title}}',
|
||
|
},
|
||
|
subtitle: {
|
||
|
// text: 'Source: somewebsite.com',
|
||
|
text: '{{.SubTitle}}',
|
||
|
},
|
||
|
tooltip: {
|
||
|
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
|
||
|
},
|
||
|
plotOptions: {
|
||
|
pie: {
|
||
|
allowPointSelect: true,
|
||
|
cursor: 'pointer',
|
||
|
dataLabels: {
|
||
|
enabled: true,
|
||
|
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
|
||
|
style: {
|
||
|
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
series: [{
|
||
|
// name: 'Browser share',
|
||
|
name : '{{.SerieName}}',
|
||
|
data:
|
||
|
{{.DataArray}}
|
||
|
/*
|
||
|
data:
|
||
|
[
|
||
|
['Firefox', 45.0],
|
||
|
['IE', 26.8],
|
||
|
['Chrome', 12.8],
|
||
|
['Safari', 8.5],
|
||
|
['Opera', 6.2],
|
||
|
['Others', 0.7]
|
||
|
]
|
||
|
*/
|
||
|
}]
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/4.0.1/highcharts.js"></script>
|
||
|
<script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/4.0.1/modules/exporting.js"></script>
|
||
|
|
||
|
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
|
||
|
|
||
|
</body>
|
||
|
</html>
|
||
|
{{end}}
|
||
|
`
|