訊息類型統計

by kikkoma

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>

<div id="container" style="width: 400px; height: 480px; margin: 0 auto"></div>

CSS

.highcharts-title {
    fill: #434348;
    font-weight: bold;
    letter-spacing: 0.3em;
    font-size: 3em;
    font-family:'微軟正黑體';
}

.highcharts-subtitle {
   font-family:'微軟正黑體';

}
.highcharts-color-0{
  
  
}

JavaScript

Highcharts.setOptions({
		lang: {
			thousandsSep: ','
		}
	});

Highcharts.setOptions({
    colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4']
});

// Create the chart
Highcharts.chart('container', {
  chart: {
    type: 'column'
  },
  title: {
    text: '訊息類型統計',
    style: {
            color: '#000000',
            fontWeight: 'bold',
            fontfamily:'微軟正黑體'
        }
  },
  subtitle: {
    text: '統計區間 2018/5/20 ~ 2018/7-26'
  },
  xAxis: {
    type: 'category',
    
  },
  yAxis: {
    title: {
      text: '訂閱次數'
    },
    className: 'highcharts-color-0'

  },
    legend: {
        enabled: false
    },
    plotOptions: {
        series: {
            borderWidth: 0,
            dataLabels: {
                enabled: true,
                format: '{point.y:,.0f}'
            }
        }
    },

    tooltip: {
        headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
        pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>'
    },

    "series": [
        {
            "name": "Browsers",
            "colorByPoint": true,
            "data": [
                {
                    "name": "颱風",
                    "y": 681221
                },
                {
                    "name": "地震",
                    "y": 544456
                },
                {
                    "name": "降雨",
                    "y": 588511
                },
                {
                    "name": "水庫流放",
                    "y": 358941
                },
                {
                    "name": "濃霧",
                    "y": 15740
                },
                {
                    "name": "海嘯",
                    "y": 97450
                }
            ]
        }
    ]
});