| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- $(function() {
- // 创建图表
- $('#container').highcharts({
- chart: {
- type: 'pie'
- },
- title: false,
- // yAxis: {
- // title: {
- // text: '总百分比市场份额'
- // }
- // },
- credits: {
- enabled: false // 禁用版权信息
- },
- exporting: {
- enabled: false
- }, //隐藏导出图片
- plotOptions: {
- pie: {
- shadow: false,
- center: ['50%', '50%']
- }
- },
- // tooltip: {
- //// valueSuffix: '%'
- // },s
- series: [{
- name: '应巡检',
- data: [{
- name: "数量",
- y: 300,
- color: "#3f85ed"
- }],
- size: '38%',
- dataLabels: {
- formatter: function() {
- // return this.y > 5 ? this.point.name : null;
- return this.y > 5 ? this.point.y : null;
- },
- style: {
- color: 'white',
- fontSize: '16px'
- },
- distance: -80 // 距离值为负时显示在在扇区里面
- }
- }, {
- name: '数量',
- data: [{
- name: '未巡检',
- y: 100,
- color: "#69a0f3"
- }, {
- name: '已巡检',
- y: 200,
- color: "#b891f7"
- }],
- size: '80%',
- innerSize: '60%',
- dataLabels: {
- softConnector: false, // 是否使用曲线
- connectorColor: 'red', // 连接线颜色,默认是扇区颜色
- distance: 20, // 数据标签与扇区距离
- connectorPadding: 20, // 数据标签与连接线的距离
- formatter: function() {
- // 通过函数判断是否显示数据标签,为了防止数据标签过于密集
- // return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
- return this.y > 1 ? this.y : null;
- },
- style: {
- color: 'white',
- fontSize: '16px'
- }
- }
- }]
- });
- });
|