午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

您的位置:首頁技術文章
文章詳情頁

Vue使用echarts可視化組件的方法

瀏覽:21日期:2022-09-28 09:27:58

echarts組件官網地址:https://echarts.apache.org/examples/zh/index.html

1.找到腳手架項目所在地址,執行cnpm install echarts,安裝echarts組件(腳手架的地址就是你vue項目的地址)

Vue使用echarts可視化組件的方法

(E:demovuepro)這是我的項目地址,vuepro為項目名

2.按需導入,以加快打開速度

//引入echarts組件 import echarts from 'echarts' // 引入基本模板 let echart = require(’echarts/lib/echarts’) // 引入柱狀圖組件 require(’echarts/lib/chart/bar’) // 引入提示框和title組件 require(’echarts/lib/component/tooltip’) require(’echarts/lib/component/title’)

3.準備div標簽 容納報表圖形

div的 id用于綁定echarts插件

<div style='width: 50%; height: 400px;'> </div>

4.script標簽的內容

//引入echarts組件 import echarts from 'echarts' // 引入基本模板 let echart = require(’echarts/lib/echarts’) // 引入柱狀圖組件 require(’echarts/lib/chart/bar’) // 引入提示框和title組件 require(’echarts/lib/component/tooltip’) require(’echarts/lib/component/title’) export default{name: ’App’,data(){ return{ chartColumn:null }},methods:{ initData(){ let dt=document.querySelector('#boss') this.chartColumn=echart.init(dt) this.chartColumn.setOption( //Examples中的模板 ) }},mounted(){ this.initData()} }

為了方便大家的使用,我在這里放一個在Vue中引入echarts可視化組件的完整模板,大家直接復制使用即可

<template> <div style='width: 500px;height: 500px;'> </div></template><script> //引入echarts組件 import echarts from 'echarts' // 引入基本模板 let echart = require(’echarts/lib/echarts’) // 引入柱狀圖組件 require(’echarts/lib/chart/bar’) // 引入提示框和title組件 require(’echarts/lib/component/tooltip’) require(’echarts/lib/component/title’) export default{name: ’App’,data(){ return{ chartColumn:null }},methods:{ initData(){ let dt=document.querySelector('#boss')this.chartColumn=echart.init(dt) this.chartColumn.setOption( //Examples中模板 ) }},mounted(){ this.initData()} }</script><style></style>

案例:

<template> <div style='width: 500px;height: 500px;'> </div></template><script> import echarts from 'echarts' // 引入基本模板 let echart = require(’echarts/lib/echarts’) // 引入柱狀圖組件 require(’echarts/lib/chart/bar’) // 引入提示框和title組件 require(’echarts/lib/component/tooltip’) require(’echarts/lib/component/title’) export default{name: ’App’,data(){ return{ chartColumn:null }},methods:{ initData(){ let dt=document.querySelector('#boss') this.chartColumn=echart.init(dt) this.chartColumn.setOption( //以下為echarts可視化組件 { tooltip: { trigger: ’axis’, axisPointer: { // Use axis to trigger tooltip type: ’shadow’// ’shadow’ as default; can also be ’line’ or ’shadow’ } }, legend: { data: [’Direct’, ’Mail Ad’, ’Affiliate Ad’, ’Video Ad’, ’Search Engine’] }, grid: { left: ’3%’, right: ’4%’, bottom: ’3%’, containLabel: true }, xAxis: { type: ’value’ }, yAxis: { type: ’category’, data: [’Mon’, ’Tue’, ’Wed’, ’Thu’, ’Fri’, ’Sat’, ’Sun’] }, series: [ { name: ’Direct’, type: ’bar’, stack: ’total’, label: { show: true }, emphasis: { focus: ’series’ }, data: [320, 302, 301, 334, 390, 330, 320] }, { name: ’Mail Ad’, type: ’bar’, stack: ’total’, label: { show: true }, emphasis: { focus: ’series’ }, data: [120, 132, 101, 134, 90, 230, 210] }, { name: ’Affiliate Ad’, type: ’bar’, stack: ’total’, label: { show: true }, emphasis: { focus: ’series’ }, data: [220, 182, 191, 234, 290, 330, 310] }, { name: ’Video Ad’, type: ’bar’, stack: ’total’, label: { show: true }, emphasis: { focus: ’series’ }, data: [150, 212, 201, 154, 190, 330, 410] }, { name: ’Search Engine’, type: ’bar’, stack: ’total’, label: { show: true }, emphasis: { focus: ’series’ }, data: [820, 832, 901, 934, 1290, 1330, 1320] } ] } //組件到此結束 ) }},mounted(){ this.initData()} }</script><style></style>

顯示效果:

Vue使用echarts可視化組件的方法

到此這篇關于Vue使用echarts可視化組件的方法的文章就介紹到這了,更多相關Vue echarts可視化組件內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Vue
相關文章:
主站蜘蛛池模板: 中文字幕无线码一区 | 操操操网站| 久久成人免费 | 欧美一级特黄高清视频 | 亚洲精品久久久久久久久久久久久 | 天天操天天干天天干 | 色屁屁ts人妖系列二区 | 日本a级片在线观看 | 成人精品影院 | 亚洲最大中文字幕 | 欧美黄色免费视频 | 成人欧美一区二区三区黑人免费 | 日韩欧美精品在线 | 懂色av一区二区三区在线播放 | 国产91在线高潮白浆在线观看 | 日韩欧美在线观看 | 成人免费视频国产免费 | 亚洲爱视频 | 亚洲黄色免费网站 | 亚洲免费视频观看 | 久久久久久伊人 | 免费在线成人 | av中文字幕一区二区 | 免费成人在线观看视频 | 特黄免费 | 中文字幕在线视频播放 | 欧美第一夜 | 超碰黄色 | 中文字幕在线播出 | 日韩欧美中文字幕视频 | www网站在线观看 | 好吊妞在线观看 | 色婷婷av一区二区三区软件 | 丁香婷婷成人 | 国产精品久久久久影院 | 国产一区不卡在线 | 免费在线成人网 | 黄色在线观看免费视频 | 久久99热精品 | 欧美美女一区二区 | 欧美精品v |