code: function adjustLabelPosition(label, x, y, index) {
    const bbox = label.getBBox();
    const width = bbox.width;
    const height = bbox.height;
    const attrs = {
      x,
      y,
      textAlign: 'center'
    };
    switch (index) {
      case 0:
        attrs.y -= height / 2;
        attrs.textAlign = 'left';
        break;
      case 1:
        attrs.y -= height / 2;
        attrs.textAlign = 'right';
        break;
      case 2:
        attrs.y += height / 2;
        attrs.textAlign = 'right';
        break;
      case 3:
        attrs.y += height / 2;
        attrs.textAlign = 'left';
        break;
      case 5:
        attrs.y -= height / 2;
        break;
  
      case 6:
        attrs.y += height / 2;
        break;
      case 7:
        attrs.x += width / 2;
        attrs.textAlign = 'left';
        break;
      case 8:
        attrs.x -= width / 2;
        attrs.textAlign = 'right';
        break;
      default:break;
    }
    label.attr(attrs);
    return label.getBBox();
  }
docs: /*
  根据如下规则尝试放置label
  5
  ------------------
  |    1   |   0   |
  8   —————————4————————   7
  |    2   |   3   |
  ——————————————————
  6