Vue結(jié)合echarts實現(xiàn)繪制水滴圖
更新時間:2023年07月30日 14:38:44 作者:瘋狂的小強呀
這篇文章主要為大家詳細介紹了Vue如何結(jié)合echarts實現(xiàn)水滴圖的繪制,文中的示例代碼講解詳細,感興趣的小伙伴可以跟隨小編一起學習一下
效果展示

核心代碼
<template>
<div id="cpu" style="width: 270px;height: 200px;"></div>
</template>
<script>
import * as echarts from 'echarts';
export default {
name: "show",
methods:{
aucDrawLine() {
// 基于準備好的dom,初始化echarts實例,所以只能在mounted中調(diào)用
// 這里'auc'是自己取的名字,跟div標簽屬性的id后面的值是一一對應(yīng)的
let myChart = echarts.init(document.getElementById('cpu'));
// 繪制圖表
myChart.setOption( {
title: {
text: 'CPU使用率', // 標題名
// 標題的樣式
textStyle: {
color: '#888', // 字體顏色
fontFamily: 'Microsoft YaHei', // 字體
fontSize: 20,
fontWeight: '400',
align: 'center', // 文字的水平方式
},
left: 'center', // 定位
top: '5%'
},
series: [{
type: 'liquidFill',
radius: '60%',
waveAnimation: true,
data: [{
value: 0.5,
direction: 'left',
itemStyle: {
normal: {
color: '#7DCEA0'
}
}
},
{
value: 0.45,
direction: 'right',
itemStyle: {
normal: {
color: '#52BE80 '
}
}
},
],
outline: {
show: true,
borderDistance: 5, // 邊框線與圖表的距離 數(shù)字
itemStyle: {
opacity: 0.9, // 邊框的透明度 默認為 1
borderWidth: 2, // 邊框的寬度
shadowBlur: 14, // 邊框的陰影范圍 一旦設(shè)置了內(nèi)外都有陰影
shadowColor: "#fff", // 邊框的陰影顏色,
borderColor:'#3AA66E' // 邊框顏色
}
},
itemStyle: {
opacity: 0.9, // 波浪的透明度
shadowBlur: 0 // 波浪的陰影范圍
},
backgroundStyle: {
color: '#fff' // 圖表的背景顏色
},
label: { // 數(shù)據(jù)展示樣式
show: true,
color: '#888',
insideColor: '#fff',
fontSize: 24,
fontWeight: 400,
},
}]
})
},
},
mounted() {
this.aucDrawLine();
},
}
</script>
到此這篇關(guān)于Vue結(jié)合echarts實現(xiàn)繪制水滴圖的文章就介紹到這了,更多相關(guān)Vue水滴圖內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
關(guān)于json-bigint處理大數(shù)字問題
這篇文章主要介紹了關(guān)于json-bigint處理大數(shù)字問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-05-05
Vue創(chuàng)建項目后沒有webpack.config.js(vue.config.js)文件的解決
這篇文章主要介紹了Vue創(chuàng)建項目后沒有webpack.config.js(vue.config.js)文件的解決,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-01-01
Vue3中Composition?API和Options?API的區(qū)別
Vue3的Composition API和Options API是Vue.js框架中的兩種不同的API,本文主要介紹了Vue3中Composition?API和Options?API的區(qū)別,文中通過示例代碼介紹的非常詳細,需要的朋友們下面隨著小編來一起學習學習吧2023-06-06
在vue中,v-for的索引index在html中的使用方法
下面小編就為大家分享一篇在vue中,v-for的索引index在html中的使用方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-03-03
詳解如何在Vue2中實現(xiàn)useDraggable
這篇文章主要為大家詳細介紹了Vue2中實現(xiàn)useDraggable的相關(guān)知識,文中的示例代碼簡潔易懂,對我們深入了解vue有一定的幫助,需要的小伙伴可以參考下2023-12-12

