vue echarts 随窗口变化

window.onresize = this.trendChart.resize

methods: {
  initCharts() {
     this.trendChart = echarts.init(this.$refs.trendChart)
     this.setOptions()
     window.onresize = this.trendChart.resize
   },
   setOptions() {
     this.trendChart.setOption({
       backgroundColor: '#fff',
       tooltip: {
         trigger: 'axis',
         show: true,
       },
       legend: {
         show: true,
         icon: 'circle',
         bottom: 5,
         textStyle: {
           fontSize: 14,
           color: '#c8c8c8',
         },
       },
       grid: {
         left: '5%',
         right: '5%',
         top: '15%',
         bottom: '15%',
         containLabel: true,
       },
       xAxis: {
         axisLine: {
           show: false,
         },
         axisTick: {
           show: false,
         },
         axisLabel: {
           interval: 0,
         },
         data: this.chartsTime,
       },
       yAxis: {
         axisLine: {
           show: false,
         },
         axisTick: {
           show: false,
         },
       },
       series: this.chartsData,
     })
   },
 },
上一篇:《单页web应用 javaScript从前端到后端》3.1 开发shell小例子demo


下一篇:【Web API系列教程】3.5 — 实战:处理数据(创建数据传输对象)