vue+echarts實現(xiàn)進度條式柱狀圖
更新時間:2021年09月05日 09:30:58 作者:lannieZ
這篇文章主要為大家詳細介紹了vue+echarts實現(xiàn)進度條式柱狀圖,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了vue+echarts實現(xiàn)進度條式柱狀圖的具體代碼,供大家參考,具體內(nèi)容如下
效果圖如下
代碼:
<template> <div class="content-page"> <div class="tab-content"> <div id="myChart1"></div> </div> </div> </template> <script> import * as echarts from 'echarts'; export default { data() { return { option: { color: ["#157ef5"],// 設(shè)置柱狀圖的顏色 textStyle: { color: "#828282" }, tooltip: { trigger: "axis", axisPointer: { type: "line" } }, grid: { left: "3%", right: "4%", bottom: "3%", containLabel: true }, xAxis: { type: "value", // 設(shè)置x軸顯示幾段 min: 0, max: 100, interval: 50, axisTick: { show: false }, axisLine: { lineStyle: { color: "transparent" } } }, yAxis: { type: "category", data: ["財政收入", "總部經(jīng)濟"], axisTick: { show: false }, axisLine: { lineStyle: { color: "#e0e0e0" } }, inside: true, textStyle: { color: "#000" } }, series: [ { type: "bar", itemStyle: { color: "#f1f1f1",// 定義柱形的背景色 borderRadius:[0, 10, 10, 0] //定義背景柱形的圓角 }, barGap: "-100%", //設(shè)置柱形重合的重要步驟 data: [100, 100], animation: false, // 關(guān)閉動畫效果 barWidth: "22px",// 設(shè)置柱形寬度 }, { type: "bar", data: [65, 75], barWidth: "22px", barGap: "-100%", //設(shè)置柱形重合的重要步驟 itemStyle: { borderRadius:[0, 10, 10, 0],// 定義柱形的圓角 color: function(params) { var colorList = ['#3C90EB', '#B573F4', '#F9B341', '#F9B341', '#91c7ae']; return colorList[params.dataIndex] } }, } ] } } }, mounted() { this.getChartData(); }, methods: { getChartData() { let myChart1 = echarts.init(document.querySelector("#myChart1")); myChart1.setOption(this.option); // 設(shè)置圖表初始化數(shù)據(jù) setTimeout(function() { window.onresize = function() { myChart1.resize();// 圖表根據(jù)窗口大小進行自適應(yīng) }; }, 200); } } } </script> <style lang="less" scoped> #myChart1 { width: 600px; height: 400px; } </style>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
vue-router中關(guān)于children的使用方法
這篇文章主要介紹了vue-router中關(guān)于children的使用方法,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-08-08vue 3.x 中mixin封裝公用方法應(yīng)用方式
這篇文章主要介紹了vue 3.x 中mixin封裝公用方法應(yīng)用方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-05-05淺談Vue3.0新版API之composition-api入坑指南
這篇文章主要介紹了Vue3.0新版API之composition-api入坑指南,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-04-04vue 使用html2canvas將DOM轉(zhuǎn)化為圖片的方法
這篇文章主要介紹了vue 使用html2canvas將DOM轉(zhuǎn)化為圖片的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-09-09Vue使用ElementUI動態(tài)修改table單元格背景顏色或文本顏色
本文主要介紹了Vue使用ElementUI動態(tài)修改table單元格背景顏色或文本顏色,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-02-02