(points: GraphicalItemPoint[])
| 115 | const items = props?.formattedGraphicalItems; |
| 116 | |
| 117 | const getLineWidth = (points: GraphicalItemPoint[]) => { |
| 118 | const width = points?.reduce((acc, point, index) => { |
| 119 | if (!index) return acc; |
| 120 | |
| 121 | const prevPoint = points?.[index - 1]; |
| 122 | |
| 123 | const xAxis = point?.x || 0; |
| 124 | const prevXAxis = prevPoint?.x || 0; |
| 125 | const xWidth = xAxis - prevXAxis; |
| 126 | |
| 127 | const yAxis = point?.y || 0; |
| 128 | const prevYAxis = prevPoint?.y || 0; |
| 129 | const yWidth = Math.abs(yAxis - prevYAxis); |
| 130 | |
| 131 | const hypotenuse = Math.sqrt(xWidth * xWidth + yWidth * yWidth); |
| 132 | acc += hypotenuse; |
| 133 | return acc; |
| 134 | }, 0); |
| 135 | |
| 136 | return width || 0; |
| 137 | }; |
| 138 | |
| 139 | items?.forEach((line) => { |
| 140 | const linePoints = line?.props?.points; |
no outgoing calls
no test coverage detected