(
axisGroup: Group,
axisView: CartesianAxisView | SingleAxisView,
axisModel: CartesianAxisModel | SingleAxisModel,
coordSysRect: BoundingRect,
api: ExtensionAPI
)
| 100 | } |
| 101 | |
| 102 | function rectCoordBuildBreakAxis( |
| 103 | axisGroup: Group, |
| 104 | axisView: CartesianAxisView | SingleAxisView, |
| 105 | axisModel: CartesianAxisModel | SingleAxisModel, |
| 106 | coordSysRect: BoundingRect, |
| 107 | api: ExtensionAPI |
| 108 | ): void { |
| 109 | const axis = axisModel.axis; |
| 110 | |
| 111 | if (axis.scale.isBlank() || !getScaleBreakHelper()) { |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | const breakPairs = getScaleBreakHelper()!.retrieveAxisBreakPairs( |
| 116 | axis.scale.getTicks({breakTicks: 'only_break'}), |
| 117 | tick => tick.break, |
| 118 | false |
| 119 | ); |
| 120 | if (!breakPairs.length) { |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | const breakAreaModel = (axisModel as AxisBaseModel).getModel('breakArea'); |
| 125 | const zigzagAmplitude = breakAreaModel.get('zigzagAmplitude'); |
| 126 | let zigzagMinSpan = breakAreaModel.get('zigzagMinSpan'); |
| 127 | let zigzagMaxSpan = breakAreaModel.get('zigzagMaxSpan'); |
| 128 | // Use arbitrary value to avoid dead loop if user gives inappropriate settings. |
| 129 | zigzagMinSpan = Math.max(2, zigzagMinSpan || 0); |
| 130 | zigzagMaxSpan = Math.max(zigzagMinSpan, zigzagMaxSpan || 0); |
| 131 | const expandOnClick = breakAreaModel.get('expandOnClick'); |
| 132 | const zigzagZ = breakAreaModel.get('zigzagZ'); |
| 133 | |
| 134 | const itemStyleModel = breakAreaModel.getModel('itemStyle'); |
| 135 | const itemStyle = itemStyleModel.getItemStyle(); |
| 136 | const borderColor = itemStyle.stroke; |
| 137 | const borderWidth = itemStyle.lineWidth; |
| 138 | const borderType = itemStyle.lineDash; |
| 139 | const color = itemStyle.fill; |
| 140 | |
| 141 | const group = new Group({ |
| 142 | ignoreModelZ: true |
| 143 | } as ExtendedElementProps); |
| 144 | |
| 145 | const isAxisHorizontal = axis.isHorizontal(); |
| 146 | |
| 147 | const cachedVisualList = viewCache(axisView).visualList || (viewCache(axisView).visualList = []); |
| 148 | resetCacheVisualRemoveFlag(cachedVisualList); |
| 149 | |
| 150 | for (let i = 0; i < breakPairs.length; i++) { |
| 151 | const parsedBreak = breakPairs[i][0].break.parsedBreak; |
| 152 | |
| 153 | // Even if brk.gap is 0, we should also draw the breakArea because |
| 154 | // border is sometimes required to be visible (as a line) |
| 155 | const coords: number[] = []; |
| 156 | coords[0] = axis.toGlobalCoord(axis.dataToCoord(parsedBreak.vmin, true)); |
| 157 | coords[1] = axis.toGlobalCoord(axis.dataToCoord(parsedBreak.vmax, true)); |
| 158 | if (coords[1] < coords[0]) { |
| 159 | coords.reverse(); |
nothing calls this directly
no test coverage detected
searching dependent graphs…