echarts 饼图、柱状图的数据不显示为0的设置

设置series的label,数值为0时返回空,否则返回值的名称和数值

series: [
          {
            // name: "Access From",
            type: "pie",
            radius: ["40%", "70%"],
            avoidLabelOverlap: true,  //单行标签会自动避免重叠
            // minShowLabelAngle:50,
            minShowLabelAngle:10,  //多行标签 最小标签角度设置为10
            label: {
              show: true,
              formatter: function (param) {
                if (param.value == "0") {
                  return "";
                } else {
                  return param.name + param.value;
                }
              },
            },
            center: ["35%", "55%"],
            emphasis: {
              label: {
                show: true,
              },
            },
            labelLine: {
              show: true,
            },
            data: [],
          },
        ],

你可能感兴趣的:(echarts,javascript)