<template lang='pug'> #chart(:style="{ width: '100%', height: '90%'}") </template> <script> export default { mounted() { this.chart() }, methods: { chart() { let dom = document.getElementById('chart') if (!dom) return let myCharts = this.$echarts.init(dom) let option = { // color:['#D0F0FF'], title: { text: '温度(℃)' }, tooltip: { trigger: 'axis' }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', boundaryGap: false, data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] } ], yAxis: [ { type: 'value' } ], series: [ { name: '订单数量', type: 'line', stack: '总量', smooth: true, label: { show: true, position: 'top' }, areaStyle: { normal: { color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: '#81befd' // 0% 处的颜色 }, { offset: 1, color: '#fff' // 100% 处的颜色 } ]) } }, lineStyle: { color: '#13B0FF' }, itemStyle: { normal: { color: '#13B0FF' } }, emphasis: { focus: 'series' }, data: [820, 932, 901, 934, 1290, 1330, 1320] } ] } myCharts.setOption(option) } } } </script> <style lang="scss" scoped> </style>