function markBoundary(marktype, grouptype, lineAnchor, markIndex) {
    const xy = d => [d.x, d.x, d.x, d.y, d.y, d.y];
    if (!marktype) {
      return xy; // no reactive geometry
    } else if (marktype === 'line' || marktype === 'area') {
      return d => xy(d.datum);
    } else if (grouptype === 'line') {
      return d => {
        const items = d.datum.items[markIndex].items;
        return xy(items.length ? items[lineAnchor === 'start' ? 0 : items.length - 1] : {
          x: NaN,
          y: NaN
        });
      };
    } else {
      return d => {
        const b = d.datum.bounds;
        return [b.x1, (b.x1 + b.x2) / 2, b.x2, b.y1, (b.y1 + b.y2) / 2, b.y2];
      };
    }
  }
Factory function for function for getting base mark boundary, depending
on mark and group type. When mark type is undefined, line or area: boundary
is the coordinate of each data point. When base mark is grouped line,
boundary is either at the start or end of the line depending on the
value of lineAnchor. Otherwise, use bounds of base mark.