亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

vue怎么實現echarts中的儀表盤

發布時間:2022-03-28 09:07:22 來源:億速云 閱讀:362 作者:iii 欄目:開發技術

這篇文章主要介紹“vue怎么實現echarts中的儀表盤”,在日常操作中,相信很多人在vue怎么實現echarts中的儀表盤問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”vue怎么實現echarts中的儀表盤”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

最終結果

vue怎么實現echarts中的儀表盤

一、安裝

1. 首先需要安裝echarts依賴包

npm install echarts -S

2. 或者使用國內的淘寶鏡像:

npm install -g cnpm --registry=https://registry.npm.taobao.org

二、創建圖表

全局引入

main.js

// 引入echarts
import echarts from 'echarts'

Vue.prototype.$echarts = echarts

Hello.vue

<div id="myChart" :></div>
export default {
    data(){
      return {}
    }, 
     mounted(){
        this.myChart() //函數調用
     },
     methods:{
        myChart() {
        let columnar = this.$echarts.init(document.getElementById('myChart'));
        columnar.setOption({
          tooltip : {
            formatter: "{a} <br/>{c} {b}"
          },
          toolbox: {
            show: true,
            feature: {
              restore: {show: true},
              saveAsImage: {show: true}
            }
          },
          series : [
           {
                    name: '空氣質量:',
                    type: 'gauge',
                    z: 3,
                    min: 0,
                    max: 500,
                    splitNumber: 10,
                    radius: '60%',
                    axisLine: {
                        lineStyle: {
                            width: 10,
                            color: [[0.1, 'green'], [0.2, 'yellow'],[0.3, 'orange'],[0.4,'#db555e'],[0.5,'#ba3779'],[1.1,'#881326'] ]
                        }
                    },
                    axisTick: {
                        length: 15,
                        lineStyle: {
                            color: 'auto'
                        }
                    },
                    //刻度分割線樣式
                    splitLine: {
                        length: 20,
                        lineStyle: {
                            color: 'white'
                        }
                    },
                    //刻度數字樣式
                    axisLabel: {
                        fontWeight:'bold',
                        color: '#0085FF',
                    },
                    detail : {
                        //說明數字大小
                        formatter: function (value) {
                            return value;
                        },
                        offsetCenter:['0%','80%'],
                        fontWeight: 'bolder',
                        borderRadius: 3,
                        backgroundColor: '#0085FF',
                        fontSize:14,
                        width: 100,
                        color: 'white',
                        padding:[5,15,2,15]
                    },
                data:[1,2,3,4,5,6,7]
                },
            {
                    name: 'PM2.5:',
                    type: 'gauge',
                    center: ['20%', '55%'],
                    radius: '40%',
                    min:0,
                    max:350,
                    valu:55,
                    endAngle:45,
                    splitNumber:5,
                    axisLine: {
                        lineStyle: {
                            width: 8,
                            color: [[0.2, 'green'], [0.4, 'yellow'],[1.1,'orange'] ]
                        }
                    },
                

                    axisTick: {
                        length:12,
                        lineStyle: {
                            color: 'auto'
                        }
                    },
                    splitLine: {
                        length:20,
                        lineStyle: {
                            color: 'auto'
                        }
                    },
                    pointer: {
                        width:5,
                        color:'red'
                    },
                //刻度數字樣式
                    axisLabel: {
                        fontWeight:'bold',
                        color: '#0085FF',
                        fontSize:8,   //改變儀表盤內刻度數字的大小
                        
                    },
                    detail: {
                        formatter: function (value) {
                            return value;
                        },
                        offsetCenter:['15%','75%'],
                        fontWeight: 'bolder',
                        borderRadius: 3,
                        backgroundColor: '#0085FF',
                        fontSize:14,
                        width: 100,
                        color: 'white',
                        padding:[5,15,2,15]
                    },
                    data:[1,2,3,4,5,6]
                },
           {
                    name: 'PM10:',
                    type: 'gauge',
                    //儀表盤位置
                    center: ['79%', '55%'],
                    //儀表盤半徑
                    radius: '40%',
                    min:0,
                    max:500,
                    startAngle:130,
                    splitNumber:5,
                    //儀表盤弧線寬度
                    axisLine: {
                        lineStyle: {
                            width: 8,
                            color: [[0.2, 'green'], [0.4, 'yellow'],[1, 'orange'] ]
                        }  
                        
                    },
                    //儀表盤小刻度樣式
                    axisTick: {
                        length:12,
                        lineStyle: {
                            color: 'auto'
                        }
                    },
                    //儀表盤大刻度樣式
                    splitLine: {
                        length:20,
                        lineStyle: {
                            color: 'auto'
                        }
                    },
                    //儀表盤指針樣式
                    pointer: {
                        width:5,//指針的寬度
                        length:"60%", //指針長度,按照半圓半徑的百分比
                        shadowColor : 'blue', //默認透明
                        shadowBlur: 5
                    },

                    //刻度數字樣式
                    axisLabel: {
                        fontWeight:'bold',
                        color: 'auto',
                        fontSize:8,   //改變儀表盤內刻度數字的大小
                        
                    },
                    detail: {
                        //說明數字大小
                        formatter: function (value) {
                            return value;
                        },
                        //儀表盤下方文字說明
                        offsetCenter:['0%','80%'],
                        fontWeight: 'bolder',
                        borderRadius: 3,
                        backgroundColor: '#0085FF',
                        fontSize:14,
                        width: 100,
                        color: 'white',
                        padding:[5,15,2,15]
                    },
                data:[1,2,3,4]
                }
          ]
        })
      }
  }

到此,關于“vue怎么實現echarts中的儀表盤”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

庆阳市| 南陵县| 基隆市| 济源市| 太仆寺旗| 吉首市| 芒康县| 凉山| 宽城| 扎赉特旗| 万荣县| 高邑县| 巍山| 深圳市| 乌拉特中旗| 江阴市| 潞城市| 大埔区| 韶关市| 万安县| 财经| 罗定市| 屯昌县| 高青县| 舞阳县| 商丘市| 宁海县| 太湖县| 穆棱市| 柳河县| 洛宁县| 丹江口市| 岑巩县| 连南| 孝昌县| 江阴市| 伊春市| 大埔区| 故城县| 阳山县| 云林县|