企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
``` import echarts from 'echarts' const install = function (Vue) { Object.defineProperties(Vue.prototype, { $chart: { get () { return { // 一个简单的示例 first_barq: function (id) { this.chart = echarts.init(document.getElementById(id)) this.chart.clear() const optionData = { title: { text: '寝室概况', subtext: '沈阳农业大学', left: 'center' }, legend: { left: 'center', top: 'bottom', data: ['男生', '女生', '已入住', '未入住', '使用中', '未使用'] }, color: ['#6dd8da', '#b6a2de', '#009773', '#58afed', 'red', '#009773'], toolbox: { show: true, feature: { magicType: { show: true, type: ['pie', 'funnel'] } } }, series: [ { name: '男女生比例', type: 'pie', radius: [30, 80], center: ['15%', '55%'], roseType: 'nanvn', data: [ { value: 6948, name: '男生6948人' }, { value: 9408, name: '女生9408人' } ] }, { name: '入住比例', type: 'pie', radius: [30, 80], center: ['50%', '55%'], roseType: 'ruzhu', data: [ { value: 3886, name: '已入住3886人' }, { value: 160, name: '未入住160人' } ] }, { name: '床位信息', type: 'pie', radius: [30, 80], center: ['80%', '60%'], roseType: 'chuangwei', data: [ { value: 16428, name: '使用中16428床位' }, { value: 1163, name: '未使用1163床位' } ] } ] } this.chart.setOption(optionData) }, // 一个简单的示例 first_bar: function (id) { this.chart = echarts.init(document.getElementById(id)) this.chart.clear() const optionData = { title: { text: 'ECharts 入门示例' }, tooltip: {}, xAxis: { data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子'] }, yAxis: {}, series: [{ name: '销量', type: 'bar', data: [5, 20, 36, 10, 10, 20] }] } this.chart.setOption(optionData) }, // 一个简单的示例 first_bar1: function (id) { this.chart = echarts.init(document.getElementById(id)) this.chart.clear() const optionData = { title: { text: 'ECharts 入门示例' }, tooltip: {}, xAxis: { data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子'] }, yAxis: {}, series: [{ name: '销量', type: 'bar', data: [5, 20, 36, 10, 10, 20] }] } this.chart.setOption(optionData) } } } } }) } export default { install } ```