Echarts y轴高度设置(宽度铺满整个父级高度)

 // 折线图
  initLineEcharts() {
    let _this = this;
    let charts: any = _this.$echarts.init(document.getElementById("mainLine"));
    charts.setOption({
      grid: {
        x: "12%",//x 偏移量
        y: "7%", // y 偏移量
        width: "87%", // 宽度
        height: "79%"// 高度
      },
      xAxis: {
        type: "category",
        boundaryGap: false,
        data: [
          "00:00",
          "02:00",
          "04:00",
          "06:00",
          "08:00",
          "10:00",
          "12:00",
          "14:00",
          "16:00",
          "18:00",
          "20:00",
          "22:00"
        ],
        axisLabel: {
          interval: 0, // 让字体完全显示
          rotate: 20 // 字体旋转
        },
      },
      yAxis: {
        type: "value",
        // 隐藏y轴
        axisLine: {
          show: false
        },
        // 隐藏刻度线
        axisTick: {
          show: false
        },
        // 网格线设置
        splitLine: {
          type: "dashed",
          color: "#eeeeee"
        }
      },
      series: [
        {
          data: [820, 932, 901, 934, 1790, 1330, 1300, 190, 4500, 809, 400, 890],
          type: "line",
          lineStyle: {
            color: "#00A1FF"
          },
          areaStyle: {
            color: "#00A1FF"
          }
        }
      ]
    });
  }

 

你可能感兴趣的:(echarts)