echarts 柱状图跳转带走工号之类的

4 篇文章 0 订阅
<template>
  <div>
    <div id="main" style="width: 600px;height:400px;"></div>
  </div>
</template>

<script>
import * as echarts from "echarts";
export default {
  name: "WorkspaceJsonApp",
  data() {
    return {
      option: {
        title: {
          text: "世界人口总量",
          subtext: "数据来自网络"
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow"
          }
        },
        legend: {
          data: ["2011年"]
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true
        },
        xAxis: {
          type: "value",
          boundaryGap: [0, 0.01]
        },
        yAxis: {
          type: "category",
          data: ["巴西"]
        },
        series: [
          {
            name: "2011年",
            type: "bar",
            data: [
              {
                bmid: 3, // 部门id  这里的key 可以随便定义(除value外)
                num: 1, // 工号
                value: 6000 // value 是展示得数值,必须是vaLUE
              }
            ]
          }
        ]
      }
    };
  },
  mounted() {
    // 基于准备好的dom,初始化echarts实例
    this.myChart = echarts.init(document.getElementById("main"));

    // 使用刚指定的配置项和数据显示图表。
    this.myChart.setOption(this.option);
    this.myChart.on("click", function(params) {
      console.log(params); //查看params参数取出你想要的
    });
  },
  methods: {}
};
</script>

<style  scoped>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
</style>```

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值