chart4.vue 1.91 KB
Newer Older
xiexingan's avatar
xiexingan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
<template lang='pug'>
#chart4(:style="{ width: '100%', height: '90%'}")
</template>

<script>
export default {
    mounted() {
        this.chart4()
    },
    methods: {
    chart4() {
      let dom = document.getElementById('chart4')
      if (!dom) return
      let myCharts = this.$echarts.init(dom)
      let option = {
        // color:['#D0F0FF'],
        title: {
          text: '光照'
        },
        tooltip: {
          trigger: 'axis'
        },
        grid: {
          left: '3%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: [
          {
            type: 'category',
            boundaryGap: false,
            data: ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00']
          }
        ],
        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: '#FAD337' // 0% 处的颜色
                  },
                  {
                    offset: 1,
                    color: '#fff' // 100% 处的颜色
                  }
                ])
              }
            },
            lineStyle: {
              color: '#FAD337'
            },
            itemStyle: {
              normal: {
                color: '#13B0FF'
              }
            },
            emphasis: {
              focus: 'series'
            },
            data: [820, 932, 901, 934, 1290, 1330, 1320]
          }
        ]
      }
      myCharts.setOption(option)
    }
    }
}
</script>

<style lang="scss" scoped>
</style>