()
| 183 | } |
| 184 | |
| 185 | private _makeLayoutInfo(): ParallelCoordinateSystemLayoutInfo { |
| 186 | const parallelModel = this._model; |
| 187 | const rect = this._rect; |
| 188 | const xy = ['x', 'y'] as const; |
| 189 | const wh = ['width', 'height'] as const; |
| 190 | const layout = parallelModel.get('layout'); |
| 191 | const pixelDimIndex = layout === 'horizontal' ? 0 : 1; |
| 192 | const layoutLength = rect[wh[pixelDimIndex]]; |
| 193 | const layoutExtent = [0, layoutLength]; |
| 194 | const axisCount = this.dimensions.length; |
| 195 | |
| 196 | const axisExpandWidth = restrict(parallelModel.get('axisExpandWidth'), layoutExtent); |
| 197 | const axisExpandCount = restrict(parallelModel.get('axisExpandCount') || 0, [0, axisCount]); |
| 198 | const axisExpandable = parallelModel.get('axisExpandable') |
| 199 | && axisCount > 3 |
| 200 | && axisCount > axisExpandCount |
| 201 | && axisExpandCount > 1 |
| 202 | && axisExpandWidth > 0 |
| 203 | && layoutLength > 0; |
| 204 | |
| 205 | // `axisExpandWindow` is According to the coordinates of [0, axisExpandLength], |
| 206 | // for sake of consider the case that axisCollapseWidth is 0 (when screen is narrow), |
| 207 | // where collapsed axes should be overlapped. |
| 208 | let axisExpandWindow = parallelModel.get('axisExpandWindow'); |
| 209 | let winSize; |
| 210 | if (!axisExpandWindow) { |
| 211 | winSize = restrict(axisExpandWidth * (axisExpandCount - 1), layoutExtent); |
| 212 | const axisExpandCenter = parallelModel.get('axisExpandCenter') || mathFloor(axisCount / 2); |
| 213 | axisExpandWindow = [axisExpandWidth * axisExpandCenter - winSize / 2]; |
| 214 | axisExpandWindow[1] = axisExpandWindow[0] + winSize; |
| 215 | } |
| 216 | else { |
| 217 | winSize = restrict(axisExpandWindow[1] - axisExpandWindow[0], layoutExtent); |
| 218 | axisExpandWindow[1] = axisExpandWindow[0] + winSize; |
| 219 | } |
| 220 | |
| 221 | let axisCollapseWidth = (layoutLength - winSize) / (axisCount - axisExpandCount); |
| 222 | // Avoid axisCollapseWidth is too small. |
| 223 | axisCollapseWidth < 3 && (axisCollapseWidth = 0); |
| 224 | |
| 225 | // Find the first and last indices > ewin[0] and < ewin[1]. |
| 226 | const winInnerIndices = [ |
| 227 | mathFloor(round(axisExpandWindow[0] / axisExpandWidth, 1)) + 1, |
| 228 | mathCeil(round(axisExpandWindow[1] / axisExpandWidth, 1)) - 1 |
| 229 | ]; |
| 230 | |
| 231 | // Pos in ec coordinates. |
| 232 | const axisExpandWindow0Pos = axisCollapseWidth / axisExpandWidth * axisExpandWindow[0]; |
| 233 | |
| 234 | return { |
| 235 | layout: layout, |
| 236 | pixelDimIndex: pixelDimIndex, |
| 237 | layoutBase: rect[xy[pixelDimIndex]], |
| 238 | layoutLength: layoutLength, |
| 239 | axisBase: rect[xy[1 - pixelDimIndex]], |
| 240 | axisLength: rect[wh[1 - pixelDimIndex]], |
| 241 | axisExpandable: axisExpandable, |
| 242 | axisExpandWidth: axisExpandWidth, |
no test coverage detected