| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>叠加柱状图</title>
-
- <script type="text/javascript" src="../ThirdParty/js/jquery-1.8.3.min.js"></script>
-
- <script type="text/javascript" src="../ThirdParty/js/highcharts.js"></script>
-
- <script type="text/javascript" src="../ThirdParty/js/modules/exporting.js"></script>
-
- <script>
- $(function() {
- $('#container').highcharts({
- chart: {
- type: 'column'
- },
- title: {
- text: '洛阳12329客户服务热线-接通率和呼损率统计'
- },
- xAxis: {
- categories: ['苹果', '橙子', '梨', '葡萄', '香蕉']
- },
- yAxis: {
- min: 0,
- title: {
- text: '营养含量'
- },
- stackLabels: {
- enabled: true,
- style: {
- fontWeight: 'bold',
- color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
- }
- }
- },
- legend: {
- align: 'right',
- x: -70,
- verticalAlign: 'top',
- y: 20,
- floating: true,
- backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'white',
- borderColor: '#CCC',
- borderWidth: 1,
- shadow: false
- },
- tooltip: {
- formatter: function() {
- if (this.point.stackTotal != undefined)
- return '<b>' + this.x + '</b><br/>' +
- this.series.name + ': ' + this.y + '<br/>' +
- '总量: ' + this.point.stackTotal;
- else
- return '<b>' + this.x + '</b><br/>' +
- this.series.name + ': ' + this.y + '%<br/>';
- }
- },
- plotOptions: {
- column: {
- stacking: 'normal',
- dataLabels: {
- enabled: true,
- color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
- }
- }
- },
- tooltip: {
- shared: true
- },
- series: [{
- name: '维生素A',
- data: [5, 3, 4, 7, 2]
- }, {
- name: '维生素B',
- data: [2, 2, 3, 2, 1]
- }, {
- name: '维生素C',
- data: [3, 4, 4, 2, 5]
- }, {
- type: 'spline',
- name: '呼损率',
- tooltip: {
- valueSuffix: '%'
- },
- data: [3, 2.67, 3, 6.33, 3.33],
- marker: {
- lineWidth: 2,
- lineColor: Highcharts.getOptions().colors[5],
- fillColor: 'white'
- }
- }, {
- type: 'spline',
- name: '接通率',
- tooltip: {
- valueSuffix: '%'
- },
- data: [7, 7.33, 7, 3.67, 6.67],
- marker: {
- lineWidth: 2,
- lineColor: Highcharts.getOptions().colors[5],
- fillColor: 'white'
- }
- }]
- });
- });
-
- </script>
-
- </head>
- <body>
- <div id="container" style="min-width: 700px; height: 400px">
- </div>
- </body>
- </html>
|