vue-echarts实战开发

我们今天讲解vue-echarts的开发使用方法,我们先看效果;

我们直接贴代码,对应效果会有注释。

<template>
  <div class="echarts-box">
       <div id="chart_example" style=' width: 420px;height: 300px;'></div>
  </div>
</template>
<script>
import echarts from "echarts";
export default {
  data() {
    return {
    
    };
  },
  mounted() {
    this.initData();
  },
  methods: {
    initData() {
      let this_ = this;
      let myChart = echarts.init(document.getElementById("chart_example"));
      let option = {
        color: ["#29C37F"],//柱体颜色
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow"
          }
        },
        xAxis: [
          {
            type: "category",
            data: [
              "1月",
              "2月",
              "3月",
              "4月",
              "5月",
              "6月",
              "7月",
              "8月",
              "9月",
              "10月",
              "11月",
              "12月"
            ],
            axisLine: {show:false},//轴线不显示
            axisTick: {
              alignWithLabel: false
            },
            axisLabel: {
              interval: 0, //底部完整显示
              textStyle: { //修改底部字体颜色
                color: "#999999"
              }
            }
          }
        ],
        yAxis: [
          {
            show: false,//隐藏y方向刻度
            type: "value",
            textStyle: {
              color: "#999999"
            }
          }
        ],
        series: [
          {
            name: "每月花费",
            type: "bar",
            barWidth: "50%",
            data: [995, 666, 444, 858, 654, 236, 645, 546, 846, 225, 547, 356],
            itemStyle: {
              normal: {
                label: {
                  show: true, //开启显示
                  position: "top", //在上方显示
                  textStyle: {
                    //数值样式
                    color: "#29C37F",
                    fontSize: 8
                  }
                }
              }
            }
          }
        ]
      };
      myChart.setOption(option);
    },
  }
};

 

喜欢上方小程序,需要源码的,私信小编留下邮箱。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

前端_李嘉豪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值