line.vue 3.44 KB
<template>
  <div id="dialogTends"></div>
</template>

<script>
export default {
  name: "interaction",
  data() {
    return {
      title: "展板点播趋势图",
    };
  },
  props: {
    data: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  mounted() {
  },
  methods: {
    init() {
      let option = {
        tooltip: {
          trigger: "axis",
        },
        grid: {
          top: 20,
          left: "2%",
          right: 20,
          bottom: "15%",
          containLabel: true,
        },
        dataZoom: [
          {
            type: "slider",
            show: true,
            bottom: "0",
            start: 0,
            end: 100,
            height: 18,
            handleStyle: {
              color: "#d3dee5",
            },
            textStyle: {
              color: "#fff",
              fontSize: "10px",
            },
          },
        ],
        xAxis: {
          type: "category",
          boundaryGap: false, //坐标轴两边留白
          data: this.data.xAxisData,
          axisLabel: {
            //坐标轴刻度标签的相关设置。
            textStyle: {
              color: "#FFFFFF",
              fontStyle: "normal",
              fontFamily: "微软雅黑",
              fontSize: 14,
            },
          },
          axisTick: {
            //坐标轴刻度相关设置。
            show: false,
          },
          axisLine: {
            //坐标轴轴线相关设置
            lineStyle: {
              color: "rgba(98,186,255,0.6)",
              type: "solid",
            },
          },
          splitLine: {
            //坐标轴在 grid 区域中的分隔线。
            show: false,
          },
        },
        yAxis: [
          {
            type: "value",
            splitNumber: 5,
            axisLabel: {
              textStyle: {
                color: "#FFFFFFFF",
                fontStyle: "normal",
                fontFamily: "微软雅黑",
                fontSize: 12,
              },
              interval: "auto",
            },
            axisLine: {
              show: false,
            },
            axisTick: {
              show: false,
            },
            splitLine: {
              show: true,
              lineStyle: {
                color: "rgba(98,186,255,0.6)",
                type: "dashed",
              },
            },
          },
        ],
        series: [
          {
            type: "line",
            smooth: true,
            itemStyle: {
              normal: {
                color: "rgba(255,74,83,1)",
                lineStyle: {
                  color: "rgba(78,255,253,1)",
                  width: 1,
                },
                areaStyle: {
                  color: new this.$echarts.graphic.LinearGradient(0, 1, 0, 0, [
                    {
                      offset: 0,
                      color: "rgba(255,74,83,0.4)",
                    },
                    {
                      offset: 1,
                      color: "rgba(78,255,253,0.4)",
                    },
                  ]),
                },
              },
            },
            data: this.data.yAxisData
          },
        ],
      };
      let echartsDiv = this.$echarts.init(
        document.getElementById("dialogTends")
      );
      echartsDiv.setOption(option);
    },
  },
};
</script>

<style  lang="scss">
#dialogTends {
  width: 100%;
  height: 16vh;
  margin-top: 0.6rem;
}
</style>