echarts仪表盘不靠边的解决办法
- 仪表盘中,默认图表是水平垂直居中,如果要改外边距,用grid是不行的, 要用 center , center:['50%','50%'],第一个左,第二个上
- 一个整圆,要加起来小于等于359.9度,如果整360度,则开始点和结束点会重合。
-
series: [ { name: '外层', z:10, type: 'gauge', detail: { formatter: function (){ return '当前时间'; }, fontSize:12 , offsetCenter:[0,'-47%'], color:'#2d8bd5', }, title:{ show:true, fontSize:17, offsetCenter:[0,'-32%'], color:'#2d8bd5', fontWeight :"bold", }, radius:'88%', //半径 center:['50%','50%'], //边距 startAngle: '90', //开始的度数,0 度 endAngle: '-269.99', //结束的度数 min: 0, max: 12, splitNumber: 12, //分为12份 data: [{ name:getNowFormatDate() }], axisLabel: { //刻度标签 distance: '12', //标签与刻度线的距离 textStyle: { fontWeight: 'bold', fontSize: 16, color:'#2d8bd5' }, formatter: function (t) { switch (t + '') { default: return ''; } } }, axisLine:{ lineStyle:{ color:[ //整体为1,分成了12格,每个就是0.83 [0.1,"#339CCD"], [0.1,"#16497A"], [0.17,"#46A5E1"], [0.23,"#16497A"], [0.27,"#16497A"], [0.34,"#46A5E1"], [0.38,"#88CCEE"], [0.4,"#46A5E1"], [0.5,"#378FBF"], [0.59,"#46A5E1"], [0.7,"pink"], [0.85,'pink'], [0.92,"#D7E5E9"], [0.97,"#46A5E1"], [1,"#ff6000"], ], width:18 } }, axisTick: { //小刻度尺 show: false, }, splitLine: { //分割的刻度尺,大刻度尺 show: 0, }, pointer:{ // length:"120%", show:false }, }, ]