日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

echarts vue 柱状图实例_VUE中使用Echarts绘制柱状图

發布時間:2023/12/1 vue 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 echarts vue 柱状图实例_VUE中使用Echarts绘制柱状图 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在main.js中引入echarts

import echarts from ‘echarts‘

Vue.prototype.$echarts = echarts

在相應的vue中導入echarts

import echarts from ‘echarts‘;

實現柱狀圖顯示

mounted: function () {

// 基于準備好的dom,初始化echarts實例

let myChart = echarts.init(document.getElementById(‘echartss‘))

// 繪制圖表,this.echarts1_option是數據

myChart.setOption(this.echarts1_option);

}

data() {

return {

echarts1_option: {

title: {

text: ‘基本信息‘,

subtext: ‘虛假數據‘

},

tooltip: {

trigger: ‘axis‘

},

color: [‘rgba(31,13,230,0.95)‘, ‘#ff475d‘, ‘#49ef18‘, ‘#efeb23‘],

legend: [

{

data: [‘學歷層次‘, ‘職業技能‘],

},

{

top: 20,

data: [‘業績成果‘, ‘專業經歷‘],

}

],

toolbox: {

show: true,

feature: {

dataView: {

show: true, readOnly: true,

optionToContent: function (opt) {

let axisData = opt.xAxis[0].data; //坐標數據

let series = opt.series; //折線圖數據

let tdHeads = ‘

時間‘; //表頭

let tdBodys = ‘‘; //數據

series.forEach(function (item) {

//組裝表頭

tdHeads += `

${item.name}`;

});

let table = `

for (let i = 0, l = axisData.length; i < l; i++) {

for (let j = 0; j < series.length; j++) {

//組裝表數據

tdBodys += `

${series[j].data[i]}`;

}

table += `

${axisData[i]}${tdBodys}`;

tdBodys = ‘‘;

}

table += ‘

‘;

return table;

}

},

magicType: {show: true, type: [‘line‘, ‘bar‘]},

restore: {show: true},

saveAsImage: {show: true}

}

},

calculable: true,

xAxis: [

{

type: ‘category‘,

data: [‘1月‘, ‘2月‘, ‘3月‘, ‘4月‘, ‘5月‘, ‘6月‘, ‘7月‘, ‘8月‘, ‘9月‘, ‘10月‘, ‘11月‘, ‘12月‘]

}

],

yAxis: [

{

type: ‘value‘

}

],

series: [

{

name: ‘學歷層次‘,

type: ‘bar‘,

stack: ‘個人信息‘,

data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],

markPoint: {

data: [

{type: ‘max‘, name: ‘最大值‘},

{type: ‘min‘, name: ‘最小值‘}

]

},

markLine: {

data: [

{type: ‘average‘, name: ‘平均值‘}

]

}

},

{

name: ‘職業技能‘,

type: ‘bar‘,

stack: ‘個人信息‘,

data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],

markPoint: {

data: [

{name: ‘年最高‘, value: 182.2, xAxis: 7, yAxis: 183},

{name: ‘年最低‘, value: 2.3, xAxis: 11, yAxis: 3}

]

},

markLine: {

data: [

{type: ‘average‘, name: ‘平均值‘}

]

}

},

{

name: ‘業績成果‘,

type: ‘bar‘,

stack: ‘個人信息‘,

data: [2.0, 6.0, 7.0, 20.4, 21.7, 60.7, 135.6, 152.2, 56.7, 15.8, 7.0, 2.3],

markPoint: {

data: [

{name: ‘年最高‘, value: 152.2, xAxis: 7, yAxis: 153},

{name: ‘年最低‘, value: 2.0, xAxis: 1, yAxis: 2}

]

},

markLine: {

data: [

{type: ‘average‘, name: ‘平均值‘}

]

}

},

{

name: ‘專業經歷‘,

type: ‘bar‘,

stack: ‘個人信息‘,

data: [1.0, 6.9, 9.0, 36.4, 48.7, 90.7, 100.6, 122.2, 40.7, 8.8, 6.0, 2.3],

markPoint: {

data: [

{name: ‘年最高‘, value: 122.2, xAxis: 7, yAxis: 123},

{name: ‘年最低‘, value: 1.0, xAxis: 1, yAxis: 1}

]

},

markLine: {

data: [

{type: ‘average‘, name: ‘平均值‘}

]

}

}

]

},

}

},

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的echarts vue 柱状图实例_VUE中使用Echarts绘制柱状图的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。