求教!怎么实现图中的仪表盘
1条回答 默认 最新
- Haven大虹 2018-12-05 03:19关注
利用center属性,例子:
var myChart = echarts.init(document.getElementById('rateDash')); option = { tooltip: { formatter: "{a} <br/>{b} : {c}%" }, toolbox: { feature: { restore: {}, saveAsImage: {} }, show: false }, series: [ { startAngle: 180, //开始角度 左侧角度 endAngle: 0, //结束角度 右侧 type: 'gauge', center: ['15%', '50%'], //**调整仪表盘的位置** detail: { formatter: '{value}', color: '#ee83af', fontSize: 26, fontWeight: 'bolder' }, axisLine: { lineStyle: { color: [[1, '#75caff']] } }, itemStyle: { color:'#b6bcfb' }, splitLine:{ show: false }, axisTick: { show: false }, axisLabel: { show: true, fontSize: 16, distance: -10, padding: [24, 0, 0, 0], formatter: function (value) { switch (value) { case 0: return 0;//首位刻度 case 100: return 200;//末尾刻度 default: return ''; } } } , pointer: { width: 6 }, data: [{ value: 50, name: '客流'}], title: { show: true, offsetCenter: [0, '70%'], textStyle: { fontWeight: 'bolder', fontSize: 26, color: '#b6bcfb' } } }, { startAngle: 180, //开始角度 左侧角度 endAngle: 0, //结束角度 右侧 type: 'gauge', center: ['35%', '50%'], //**调整仪表盘的位置** detail: { formatter: '{value}', color: '#ee83af', fontSize: 26, fontWeight: 'bolder' }, axisLine: { lineStyle: { color: [[1, '#75caff']] } }, itemStyle: { color: '#b6bcfb' }, splitLine: { show: false }, axisTick: { show: false }, axisLabel: { show: true, fontSize: 16, distance: -10, padding: [24, 0, 0, 0], formatter: function (value) { switch (value) { case 0: return 0;//首位刻度 case 100: return 2000;//末尾刻度 default: return ''; } } }, pointer: { width: 6 }, data: [{ value: 800, name: '销售额' }], title: { show: true, offsetCenter: [0, '70%'], textStyle: { fontWeight: 'bolder', fontSize: 26, color: '#b6bcfb' } } } ] }; setInterval(function () { option.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0; option.series[1].data[0].value = (Math.random() * 100).toFixed(2) - 0; myChart.setOption(option, true); }, 2000); myChart.setOption(option, true);
解决 无用评论 打赏 举报
悬赏问题
- ¥60 版本过低apk如何修改可以兼容新的安卓系统
- ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
- ¥50 有数据,怎么建立模型求影响全要素生产率的因素
- ¥50 有数据,怎么用matlab求全要素生产率
- ¥15 TI的insta-spin例程
- ¥15 完成下列问题完成下列问题
- ¥15 C#算法问题, 不知道怎么处理这个数据的转换
- ¥15 YoloV5 第三方库的版本对照问题
- ¥15 请完成下列相关问题!
- ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?