echarts - 柱状图a

111 阅读1分钟
  1. 图片示例

    image.png

  2. 配置项

    options = {
        tooltip: {
          trigger: "axis",
          axisPointer: {
            // 坐标轴指示器,坐标轴触发有效
            type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
          },
        },
        color: ["#1adffe", "#fe5656"],
        backgroundColor: "",
        legend: {
          textStyle: {
            color: ["#1adffe", "#fe5656", "#fe5653"], //字体颜色
          },
          data: ["阴性", "阳性"],
        },
        grid: {
          top: "15%",
          left: "1%",
          right: "1%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: [
          {
            type: "category",
            // data: ["24小时", "48小时", "72小时", "7日内", "7日以为"],
            data: data.xAxis,
            axisTick: {
              alignWithLabel: false,
              show: false,
            },
            // axisLine: {
            //   show: false,
            // },
            axisLine: {
              lineStyle: {
                color: "#235f74",
                width: 2, //这里是为了突出显示加上的
              },
            },
            splitLine: {
              show: false,
            },
            axisLabel: {
              interval: 0,
              color: "#ffffff",
            },
            splitArea: {
              show: false,
            },
          },
        ],
        yAxis: [
          {
            type: "value",
    
            axisTick: {
              show: false,
            },
            // axisLine: {
            //   show: false,
            // },
            axisLine: {
              lineStyle: {
                color: "#235f74",
                width: 2, //这里是为了突出显示加上的
              },
            },
            splitLine: {
              show: false,
            },
            axisLabel: {
              interval: 0,
              color: "#ffffff",
            },
            splitArea: {
              show: false,
            },
            // boundaryGap: [0, 2],
          },
        ],
        series: data.series,
        animationDuration: 2800,
        // series: [
        //   {
        //     name: "阴性",
        //     type: "bar",
        //     data: [79, 52],
        //   },
        //   {
        //     name: "阳性",
        //     type: "bar",
        //     data: [80, 52],
        //   },
        // ],
      }