Vue结合echarts实现绘制水滴图
更新时间:2023年07月30日 14:38:44 作者:疯狂的小强呀
这篇文章主要为大家详细介绍了Vue如何结合echarts实现水滴图的绘制,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下
效果展示

核心代码
<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中调用
// 这里'auc'是自己取的名字,跟div标签属性的id后面的值是一一对应的
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, // 边框线与图表的距离 数字
itemStyle: {
opacity: 0.9, // 边框的透明度 默认为 1
borderWidth: 2, // 边框的宽度
shadowBlur: 14, // 边框的阴影范围 一旦设置了内外都有阴影
shadowColor: "#fff", // 边框的阴影颜色,
borderColor:'#3AA66E' // 边框颜色
}
},
itemStyle: {
opacity: 0.9, // 波浪的透明度
shadowBlur: 0 // 波浪的阴影范围
},
backgroundStyle: {
color: '#fff' // 图表的背景颜色
},
label: { // 数据展示样式
show: true,
color: '#888',
insideColor: '#fff',
fontSize: 24,
fontWeight: 400,
},
}]
})
},
},
mounted() {
this.aucDrawLine();
},
}
</script>
到此这篇关于Vue结合echarts实现绘制水滴图的文章就介绍到这了,更多相关Vue水滴图内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
Vue创建项目后没有webpack.config.js(vue.config.js)文件的解决
这篇文章主要介绍了Vue创建项目后没有webpack.config.js(vue.config.js)文件的解决,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教2023-01-01
Vue3中Composition API和Options API的区别
Vue3的Composition API和Options API是Vue.js框架中的两种不同的API,本文主要介绍了Vue3中Composition API和Options API的区别,文中通过示例代码介绍的非常详细,需要的朋友们下面随着小编来一起学习学习吧2023-06-06
在vue中,v-for的索引index在html中的使用方法
下面小编就为大家分享一篇在vue中,v-for的索引index在html中的使用方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2018-03-03


最新评论