柱状图-双数据

描述:当前是关于Echarts图表中的 柱状图 示例。
 
            let myData3 = [
        "联庄村",
        "唐家堡村",
        "小山村",
        "高泉村",
        "寒树村",
        "寒水村",
        "中化村 ",
        "金华村",
        "好地掌村",
        "庙川村",
      ];
      let jch = [200, 340, 320, 220, 360, 300, 160, 400, 250, 280];
      let tph = [160, 300, 280, 180, 300, 240, 120, 340, 200, 250];
      let option = {
        backgroundColor: "#071B3D",
        legend: {
          icon: "rect",
          itemWidth: 14,
          itemHeight: 10,
          itemGap: 20,
          textStyle: {
            fontSize: 14,
            color: "#fff",
          },
          data: ["监测户", "脱贫户"],
          selectedMode: false,
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
            textStyle: {
              color: "#fff",
            },
          },
          textStyle: {
            color: "#fff",
          },
          backgroundColor: "rgba(17,95,182,0.5)", //设置背景颜色
          formatter: "{b}:{c}",
        },
        grid: {
          left: "3%",
          right: "3%",
          bottom: "1%",
          top: "18%",
          containLabel: true,
        },
        xAxis: {
          type: "category",
          data: myData3,
          axisPointer: {
            type: "shadow",
          },
          axisLabel: {
            color: "rgba(255, 255, 255, .8)",
            interval: 0,
            rotate: 30,
            margin: 15,
          },
          axisLine: {
            show: true,
            lineStyle: {
              color: "rgba(45, 67, 119, 0.8)",
            },
          },
          splitLine: {
            show: false,
          },
          axisTick: {
            show: false,
          },
        },
        yAxis: {
          type: "value",
          name: "(户)",
          nameTextStyle: {
            color: "#fff",
            fontSize: 14,
          },
          axisLine: {
            show: true,
            lineStyle: {
              color: "rgba(45, 67, 119, 0.8)",
            },
          },
          min: 0,
          axisLabel: {
            show: true,
            color: "#fff",
          },
          axisTick: {
            show: false,
          },
          splitLine: {
            show: true,
            lineStyle: {
              width: 0.5,
              color: "rgba(45, 67, 119, .5)",
              type: "dashed",
            },
          },
        },
        series: [
          {
            data: jch,
            name: "监测户",
            type: "bar",
            barWidth: "10px",
            itemStyle: {
              normal: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  {
                    offset: 0,
                    color: "rgba(80, 135, 236, .8)",
                  },

                  {
                    offset: 1,
                    color: "rgba(80, 135, 236, .2)",
                  },
                ]),
              },
            },
            label: {
              show: false,
              position: "top",
              fontSize: 12,
              color: "#F5F5F5",
              offset: [0, -5],
              formatter: "{c}",
            },
          },
          {
            data: tph,
            name: "脱贫户",
            type: "bar",
            barWidth: "10px",
            itemStyle: {
              normal: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  {
                    offset: 0,
                    color: "rgba(104, 187, 196, .8)",
                  },

                  {
                    offset: 1,
                    color: "rgba(104, 187, 196, .2)",
                  },
                ]),
              },
            },
            label: {
              show: false,
              position: "top",
              fontSize: 12,
              color: "#F5F5F5",
              offset: [0, -5],
              formatter: "{c}",
            },
          },
        ],
      };