vue3+echarts+折線投影(陰影)效果的實(shí)現(xiàn)
更新時(shí)間:2023年10月09日 10:20:18 作者:妍崽崽@
這篇文章主要介紹了vue3+echarts+折線投影(陰影)效果的實(shí)現(xiàn)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
前言
折線投影效果的實(shí)現(xiàn)。
實(shí)現(xiàn)效果



實(shí)現(xiàn)方法
1.引入echart
cnpm i --save echarts import * as echarts from 'echarts';
2.頁(yè)面上定義dom
<template>
<div id="echartLine" class="echartDiv">
折線圖
</div>
</template>3.具體實(shí)現(xiàn)代碼,series添加
shadowColor: 'rgba(0, 0, 0, 1)',//設(shè)置折線陰影
源碼:
<template>
<div id="echartLine" class="echartDiv" style="width: 100%;height: 400px;">
</div>
</template>
<script>
import * as echarts from 'echarts';
import { onMounted,nextTick } from 'vue';
export default {
setup(){
const echartInit = () =>{;
var myChart = echarts.init(document.getElementById('echartLine'));
// 指定圖表的配置項(xiàng)和數(shù)據(jù)
let option = option = {
grid: {
top: '15%',
right: '10%',
left: '10%',
bottom: '12%'
},
xAxis: [{
type: 'category',
color: '#59588D',
data: ['2019Q1', '2019Q2', '2019Q3', '2019Q4'],
axisLabel: {
margin: 20,
color: '#999',
textStyle: {
fontSize: 18
},
},
axisLine: {
lineStyle: {
color: 'rgba(107,107,107,0.37)',
}
},
axisTick: {
show: false
},
}],
yAxis: [{
axisLabel: {
formatter: '{value}%',
color: '#999',
textStyle: {
fontSize: 18
},
},
axisLine: {
lineStyle: {
color: 'rgba(107,107,107,0.37)',
}
},
axisTick: {
show: false
},
splitLine: {
lineStyle: {
color: 'rgba(131,101,101,0.2)',
type: 'dashed',
}
}
}],
series: [{
data: [48, 40, 10, -6],
type: 'line',
smooth: true,
name: '折線圖',
symbol: 'none',
lineStyle: {
color: '#3275FB',
width: 4,
shadowColor: 'rgba(0, 0, 0, 1)',//設(shè)置折線陰影
shadowBlur: 15,
shadowOffsetY: 20,
}
}
]
};
// 使用剛指定的配置項(xiàng)和數(shù)據(jù)顯示圖表。
myChart.setOption(option);
}
//掛載
onMounted(()=>{
nextTick(()=>{
echartInit()
})
})
return {
};
}
}
</script>總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
VueJs里利用CryptoJs實(shí)現(xiàn)加密及解密的方法示例
這篇文章主要介紹了VueJs里利用CryptoJs實(shí)現(xiàn)加密及解密的方法示例,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2019-04-04
Vue使用v-viewer插件實(shí)現(xiàn)圖片預(yù)覽和縮放和旋轉(zhuǎn)等功能(推薦)
v-viewer是一個(gè)基于viewerjs封裝的vue圖片預(yù)覽組件,有預(yù)覽縮放拉伸旋轉(zhuǎn)切換拖拽等功能,支持配置化,這篇文章主要介紹了Vue使用v-viewer插件實(shí)現(xiàn)圖片預(yù)覽和縮放和旋轉(zhuǎn)等功能,需要的朋友可以參考下2023-02-02
vue動(dòng)態(tài)禁用控件綁定disable的例子
今天小編就為大家分享一篇vue動(dòng)態(tài)禁用控件綁定disable的例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2019-10-10
Vue實(shí)現(xiàn)點(diǎn)擊顯示不同圖片的效果
這篇文章主要為大家詳細(xì)介紹了Vue實(shí)現(xiàn)點(diǎn)擊顯示不同圖片的效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-08-08
在Vue中延遲執(zhí)行某個(gè)函數(shù)的實(shí)現(xiàn)方式
在Vue中延遲執(zhí)行某個(gè)函數(shù),你可以使用setTimeout()函數(shù)或者Vue提供的生命周期鉤子函數(shù),本文通過一些示例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作有一定的幫助,需要的朋友可以參考下2023-12-12
淺談vue websocket nodeJS 進(jìn)行實(shí)時(shí)通信踩到的坑
這篇文章主要介紹了淺談vue websocket nodeJS 進(jìn)行實(shí)時(shí)通信踩到的坑,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2020-09-09

