echarts的title怎么显示数据总和

就是图片里红框的总数是蓝框数据相加,但是echarts的title要怎么写才能达成这种效果?

img

async ShorepowermaintainStatistics() {
      let res = await shorepowermaintainStatistics(this.listQuery);
      if (res.code === "0") {
        var option1 = {
          title: {
            text: "设备总数:3136 台",
            textStyle: {
              color: "#00FFFF",
              fontSize: "14px",
            },
            right: 0,
            top: 15,
          },
          legend: {
            right: 0,
            top: "center",
            orient: "",
            icon: "circle",
            textStyle: {
              color: "white",
            },
            formatter: function (name) {
              var data = option1.series.data;
              var total = 0;
              var tarValue;
              for (var i = 0, l = data.length; i < l; i++) {
                total += data[i].value;
                if (data[i].name == name) {
                  tarValue = data[i].value;
                }
              }
              var p = ((tarValue / total) * 100).toFixed(1);
              return name + " " + " | " + " " + " " + p + "% " + tarValue;
            },
          },
          tooltip: {},
          series: {
            name: "",
            type: "pie",
            radius: ["40%", "90%"],
            center: ["30%", "55%"],
            roseType: "area",
            label: {
              show: false,
            },
            color: ["#0EBB5B", "#F19149", "#A0A0A0"],
            data: [
              { value: res.data.neiHe, name: "内河" },
              { value: res.data.yanJiang, name: "沿江" },
              { value: res.data.yanHai, name: "沿海" },
            ],
          },
        };
        this.$nextTick(() => {
          const chart1 = document.getElementById("shore_constructor");
          const myChart = this.$echarts.init(chart1);
          // 绘制图表
          myChart.setOption(option1);
        });
      }
    },

动态赋值

if (res.code === "0") {
        const total = 0 
        //循环数组,数量相加,赋给total
        var option1 = {
          title: {
            text: `设备总数:${total}台`,
            textStyle: {
              color: "#00FFFF",
              fontSize: "14px",
            },
            right: 0,
            top: 15,
          },

res.data加起来放里面不就可以啦

给个变量