百万级可视化开发进阶笔记———今日交易用户数

效果图:
在这里插入图片描述
TodayUser下 index.vue

<template>
  <common-card
  title="今日交易用户数"
  value="62,832"
  >
     <template>
       <div id="today-user-chart" :style="{width:'100%',height:'100%'}"></div>
     </template>
    <template v-slot:footer>
      <span>退货率</span>
      <span class="emphasis">5.06%</span>
    </template>
  </common-card>
</template>

<script>
import commonCardMixin from '@/mixins/commonCardMixin'
export default {
  name: 'today-user',
  mixins: [commonCardMixin],
  mounted () {
    const chartDom = document.getElementById('today-user-chart')
    const chart = this.$echarts.init(chartDom)
    const data = [220, 182, 191, 234, 290, 330, 310]
    chart.setOption({
      tooltip: {
        trigger: 'axis',
        formatter: '{b} : {c}',
        axisPointer: { // 坐标轴指示器,坐标轴触发有效
          show: false,
          type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
        }
      },
      xAxis: {
        data: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
        axisLine: {
          show: false
        }
      },
      yAxis: {
        axisLine: {
          show: false
        },
        axisLabel: {
          show: false
        },
        splitLine: {
          show: false
        },
        axisTick: {
          show: false
        }
      },
      series: [{
        name: 'a',
        tooltip: {
          show: false
        },
        type: 'bar',
        barWidth: 10,
        itemStyle: {
          normal: {
            color: new this.$echarts.graphic.LinearGradient(0, 1, 0, 0, [{
              offset: 0,
              color: '#0B4EC3' // 0% 处的颜色
            }, {
              offset: 0.6,
              color: '#138CEB' // 60% 处的颜色
            }, {
              offset: 1,
              color: '#17AAFE' // 100% 处的颜色
            }], false)
          }
        },
        data: data,
        barGap: 0
      }]
    })
  }
}
</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值