<!--
 * @Author: your name
 * @Date: 2021-10-19 10:01:25
 * @LastEditTime: 2021-10-19 10:09:12
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /data-show/src/views/EventComparison/cotwiEc/index.vue
-->

<template>
  <div class="cotwiEc-outter" v-loading="load">
    <v-label-div
      title="微博互动人数对比"
      :showLine="false"
      :eStyle="{ 'border-style': 'none' }"
    >
    </v-label-div>
    <div class="cotwiEc-inner">
      <v-echarts :opt="opt"></v-echarts>
    </div>
  </div>
</template>

<script>
import { getInteractCount0528C } from "@/api/EventComparison";
import { createSingleColumnar } from "@/utils/gol/singleColumnar";
export default {
  name: "cotwiEc",
  data() {
    return {
      opt: createSingleColumnar(["事件一", "事件二"], [2200, 1900], "#52bb90"),
      form: {
        token: "",
        sRele: "",
        load: false,
      },
    };
  },
  created() {
    this.initData();
  },
  methods: {
    initData() {
      this.form.token = this.getToken;
      let arr = [];
      this.getEComparison.forEach((ele) => {
        arr.push(ele.events_id);
      });
      this.form.sRele = arr.toString();
      this.getData();
    },
    getData() {
      let obj = Object.assign({}, this.getCtime2, this.form);
      this.load = true;
      getInteractCount0528C(obj).then((res) => {
        let data = res.data || [];
        let dx = [];
        let ds = [];
        data.forEach((e) => {
          dx.push(e.key);
          ds.push(e.value);
        });
        this.opt = createSingleColumnar(dx, ds,"#52bb90");
        this.load = false;
      });
    },
  },
};
</script>

<style lang="less" scoped>
.cotwiEc-outter {
  width: 472px;
  height: 412px;
  .cotwiEc-inner {
    width: 100%;
    height: calc(100% - 48px);
  }
}
</style>
