亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Vue3 Echarts通用的折線圖帶陰影效果實(shí)現(xiàn)

 更新時間:2024年07月04日 14:38:31   作者:陳琦鵬  
在環(huán)保倉管項(xiàng)目中,做了一個每月對藥品、消耗品、設(shè)備的進(jìn)出,進(jìn)行統(tǒng)計(jì)百分比,效果好看,后面經(jīng)常在用這個樣式,下面通過示例代碼分享Vue3 Echarts通用的折線圖帶陰影效果實(shí)現(xiàn),感興趣的朋友一起看看吧

在環(huán)保倉管項(xiàng)目中,做了一個每月對藥品、消耗品、設(shè)備的進(jìn)出,進(jìn)行統(tǒng)計(jì)百分比,效果好看,后面經(jīng)常在用這個樣式,以下是詳細(xì)分析:

下載Echarts

//npm
npm install echarts --save
//淘寶鏡像cnpm(安裝速度快)
cnpm install echarts --save
//yarn
yarn add echarts

代碼示例

<template>
    <div id="echartsThree" style="width: 100%;height: 100%;"></div>
</template>
<script setup>
    import * as echarts from 'echarts';
    import { onMounted,ref } from 'vue';
    onMounted(()=>{
        getEcharts();
    })
    const getEcharts = () => {
        let chartDom = document.getElementById("echartsThree");
        let myChart = echarts.init(chartDom);
        let rq = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
        let seriesArr = []
        let list = [{
      		name: "藥品",
      		children: [100, 100, 100, 100, 80, 90, 100, 88, 88, 99, 100, 80]
      	},
      	{
      		name: "消耗品",
      		children: [50, 50, 40, 40, 35, 40, 30, 35, 30, 30, 25, 25]
      	},
      	{
      		name: "設(shè)備",
      		children: [75, 75, 55, 55, 45, 50, 40, 30, 35, 40, 50, 50]
      	}
      ]
      let colorArr = ["0, 62, 246", "0, 193, 142", "253, 148, 67"]
      list.forEach((val, index) => {
      	seriesArr.push({
      		name: val.name,
      		type: 'line',
      		symbolSize: 6,
      		data: val.children,
      		areaStyle: {
      			normal: {
      				color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
      					offset: 0,
      					color: `rgba(${colorArr[index]},.2)`
      				}, {
      					offset: 1,
      					color: 'rgba(255, 255, 255,0)'
      				}], false)
      			}
      		},
      		itemStyle: {
      			normal: {
      				color: `rgb(${colorArr[index]})`
      			}
      		},
      		lineStyle: {
      			normal: {
      				width: 2,
      				shadowColor: `rgba(${colorArr[index]}, .2)`,
      				shadowBlur: 4,
      				shadowOffsetY: 25
      			}
      		}
      	})
      })
      let option = {
      	backgroundColor: "#fff",
      	tooltip: {
      		trigger: 'axis',
      		axisPointer: {
      			lineStyle: {
      				color: '#ddd'
      			}
      		},
      		backgroundColor: 'rgba(255,255,255,1)',
      		padding: [5, 10],
      		textStyle: {
      			color: '#000',
      		}
      	},
      	legend: {
      		right: "center",
      		top: "6%",
      		textStyle: {
      			color: '#000',
      			fontSize: 12,
      			fontWeight: 600
      		},
      		data: list.map(val => {
      			return val.name
      		})
      	},
      	grid: {
      		left: '2%',
      		right: '5%',
      		bottom: '6%',
      		top: '18%',
      		containLabel: true
      	},
      	xAxis: {
      		type: 'category',
      		data: rq,
      		boundaryGap: false,
      		splitLine: {
      			show: true,
      			interval: 'auto',
      			lineStyle: {
      				type: "dashed",
      				color: ['#cfcfcf']
      			}
      		},
      		axisTick: {
      			show: false
      		},
      		axisLine: {
      			lineStyle: {
      				color: '#cfcfcf'
      			}
      		},
      		axisLabel: {
      			// margin: 10,
      			textStyle: {
      				fontSize: 12,
      				color: "#9e9d9f",
      				fontWeight: 600
      			}
      		}
      	},
      	yAxis: [{
      		name: "(%)",
      		type: 'value',
      		splitLine: {
      			show: true,
      			lineStyle: {
      				type: "dashed",
      				color: ['#cfcfcf']
      			}
      		},
      		axisTick: {
      			show: false
      		},
      		axisLine: {
      			show: true,
      			lineStyle: {
      				fontSize: 12,
      				color: '#cfcfcf',
      			}
      		},
      		axisLabel: {
      			textStyle: {
      				fontSize: 12,
      				color: "#9e9d9f",
      				fontWeight: 600
      			}
      		},
      		max: 100
      	}],
      	series: seriesArr
      };
        myChart.setOption(option);
    }
</script>

運(yùn)行結(jié)果

到此這篇關(guān)于Vue3 Echarts通用的折線圖帶陰影的文章就介紹到這了,更多相關(guān)vue3 echarts折線圖內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • vue中的v-show,v-if,v-bind的使用示例詳解

    vue中的v-show,v-if,v-bind的使用示例詳解

    這篇文章主要介紹了vue中的v-show,v-if,v-bind的使用,本文通過示例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-04-04
  • 使用 Vue 綁定單個或多個 Class 名的實(shí)例代碼

    使用 Vue 綁定單個或多個 Class 名的實(shí)例代碼

    這篇文章主要介紹了使用 Vue 綁定單個或多個 Class 名的實(shí)例代碼,非常不錯,具有參考借鑒價(jià)值,需要的朋友參考下吧
    2018-01-01
  • vue3.0實(shí)現(xiàn)點(diǎn)擊切換驗(yàn)證碼(組件)及校驗(yàn)

    vue3.0實(shí)現(xiàn)點(diǎn)擊切換驗(yàn)證碼(組件)及校驗(yàn)

    這篇文章主要為大家詳細(xì)介紹了vue3.0實(shí)現(xiàn)點(diǎn)擊切換驗(yàn)證碼(組件)及校驗(yàn),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-11-11
  • 詳解Vue里循環(huán)form表單項(xiàng)實(shí)例

    詳解Vue里循環(huán)form表單項(xiàng)實(shí)例

    本文主要介紹了Vue里循環(huán)form表單項(xiàng)實(shí)例,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-09-09
  • 如何在 vue3 中使用高德地圖

    如何在 vue3 中使用高德地圖

    這篇文章主要介紹了如何在 vue3 中使用高德地圖,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),感興趣的朋友跟隨小編一起看看吧
    2024-08-08
  • Vue2中使用自定義指令實(shí)現(xiàn)el-table虛擬列表的代碼示例

    Vue2中使用自定義指令實(shí)現(xiàn)el-table虛擬列表的代碼示例

    在實(shí)際開發(fā)中,我們可能會面臨其他需求,例如在 el-table 中無法使用分頁技術(shù)的情況下展示海量數(shù)據(jù),這種情況下,頁面可能會出現(xiàn)卡頓,嚴(yán)重時甚至可能引發(fā)瀏覽器崩潰,所以針對這個問題本文給大家介紹了vue2中使用自定義指令實(shí)現(xiàn)el-table虛擬列表,需要的朋友可以參考下
    2025-01-01
  • vue實(shí)現(xiàn)數(shù)字動態(tài)翻牌的效果(開箱即用)

    vue實(shí)現(xiàn)數(shù)字動態(tài)翻牌的效果(開箱即用)

    這篇文章主要介紹了vue實(shí)現(xiàn)數(shù)字動態(tài)翻牌的效果(開箱即用),實(shí)現(xiàn)原理是激將1到9的數(shù)字豎直排版,通過translate移動位置顯示不同數(shù)字,本文通過實(shí)例代碼講解,需要的朋友可以參考下
    2019-12-12
  • vue腳手架中配置Sass的方法

    vue腳手架中配置Sass的方法

    本篇文章主要介紹了vue腳手架中配置Sass的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-01-01
  • vue自定義上傳頭像組件功能

    vue自定義上傳頭像組件功能

    這篇文章主要介紹了vue自定義上傳頭像組件功能,介紹了與一般上傳組件的區(qū)別,通過實(shí)例代碼介紹了上傳圖片組件的方法,需要的朋友可以參考下
    2024-01-01
  • vue router嵌套路由在history模式下刷新無法渲染頁面問題的解決方法

    vue router嵌套路由在history模式下刷新無法渲染頁面問題的解決方法

    這篇文章主要介紹了vue router嵌套路由在history模式下刷新無法渲染頁面問題的解決方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-01-01

最新評論