echarts 仪表盘两个侧边角度变为弧形

直接贴上希望看到的图片和做到的图片,求大神指点

希望做到的样式
clipboard.png

已经做到的样式
clipboard.png

代码如下

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>当前设备合格率</title>
    <script type="text/javascript" src="js/echarts.js" ></script>
    <script type="text/javascript" src="js/jquery-3.2.1.min.js" ></script>
</head>
<body>
    <div id="main" style=" width: 300px; height: 300px;"></div>
    
    <script>
        var mycharts = echarts.init(document.getElementById("main"));
        var url = "./json/rate.json";
        
    $.get(url).done(function(data){
        var pass=data.results.pass;
        var total=data.results.total;
        var pass1 = parseFloat((parseFloat(pass))/parseFloat(total)).toFixed(2);
        var va=10;
        console.log(pass1);
        option = {
            viewMap: {
                symbol: 'circle',
            },
            tooltip : {
                formatter: "{a} <br/>{b} : {c}%"
            },
            toolbox: {
                feature: {
                    restore: {},
                    saveAsImage: {}
                }
            },
            series: [
                {
                    name: '业务指标',
                    type: 'gauge',
                    splitNumber: 0,
                    axisLabel: {
                      show: false, 
                      distance: 0,
                    },
                    pointer: {
                        show: false
                    },
                 
                     splitLine: {
                         show: false,
                     },
                     axisTick : {
                         show: false,
                     },
                    axisLine: {

                        lineStyle: {
                            width: 20,
                            color: [
                                [pass1, '#91c7ae'],
                                [ 1,'#eee']
                            ]
                        }
                    
                    },
                    title : {
                        offsetCenter: [0, '10%'],       // x, y,单位px
                        textStyle: {       // 其余属性默认使用全局文本样式,详见TEXTSTYLE
                            fontWeight: 'bolder',
                            fontSize: 20,
                            fontStyle: 'italic',
                          //  color: '#fff',
                         
                        }
                    },
                    detail : {
                        offsetCenter: ["-0%", '-25%'],       // x, y,单位px
                        color:"#ff0000",
                        formatter: va+'%',
                        textStyle: {       // 其余属性默认使用全局文本样式,详见TEXTSTYLE
                            fontWeight: 'bolder',
                           // color: '#fff'
                        }
                    },
                    data: [
                        {value: 90, name:"完成率"}
                    ]
                }
            ]
        }
        
        mycharts.setOption(option);
    })
        
        
        
    </script>
    
</body>

</html>

阅读 4.8k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题