MCPcopy
hub / github.com/apache/echarts / rectCoordBuildBreakAxis

Function rectCoordBuildBreakAxis

src/component/axis/axisBreakHelperImpl.ts:102–318  ·  view source on GitHub ↗
(
    axisGroup: Group,
    axisView: CartesianAxisView | SingleAxisView,
    axisModel: CartesianAxisModel | SingleAxisModel,
    coordSysRect: BoundingRect,
    api: ExtensionAPI
)

Source from the content-addressed store, hash-verified

100}
101
102function 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();

Callers

nothing calls this directly

Calls 14

getScaleBreakHelperFunction · 0.90
ensureVisualInCacheFunction · 0.85
addZigzagShapesFunction · 0.85
removeUnusedCacheVisualFunction · 0.85
getItemStyleMethod · 0.80
dataToCoordMethod · 0.80
dispatchActionMethod · 0.80
toGlobalCoordMethod · 0.65
getTicksMethod · 0.45
getModelMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…