* 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 beginning or end of the line depending on the
(marktype, grouptype, lineAnchor, markIndex)
| 139117 | * boundary is either at the beginning or end of the line depending on the |
| 139118 | * value of lineAnchor. Otherwise, use bounds of base mark. |
| 139119 | */ function markBoundary(marktype, grouptype, lineAnchor, markIndex) { |
| 139120 | const xy = (d)=>[ |
| 139121 | d.x, |
| 139122 | d.x, |
| 139123 | d.x, |
| 139124 | d.y, |
| 139125 | d.y, |
| 139126 | d.y |
| 139127 | ]; |
| 139128 | if (!marktype) return xy; // no reactive geometry |
| 139129 | else if (marktype === "line" || marktype === "area") return (d)=>xy(d.datum); |
| 139130 | else if (grouptype === "line") return (d)=>{ |
| 139131 | const items = d.datum.items[markIndex].items; |
| 139132 | return xy(items.length ? items[lineAnchor === "start" ? 0 : items.length - 1] : { |
| 139133 | x: NaN, |
| 139134 | y: NaN |
| 139135 | }); |
| 139136 | }; |
| 139137 | else return (d)=>{ |
| 139138 | const b = d.datum.bounds; |
| 139139 | return [ |
| 139140 | b.x1, |
| 139141 | (b.x1 + b.x2) / 2, |
| 139142 | b.x2, |
| 139143 | b.y1, |
| 139144 | (b.y1 + b.y2) / 2, |
| 139145 | b.y2 |
| 139146 | ]; |
| 139147 | }; |
| 139148 | } |
| 139149 | const Output = [ |
| 139150 | "x", |
| 139151 | "y", |