MCPcopy Index your code
hub / github.com/apache/echarts / axisTrigger

Function axisTrigger

src/component/axisPointer/axisTrigger.ts:113–211  ·  view source on GitHub ↗
(
    payload: AxisTriggerPayload,
    ecModel: GlobalModel,
    api: ExtensionAPI
)

Source from the content-addressed store, hash-verified

111 * @return content of event obj for echarts.connect.
112 */
113export default function axisTrigger(
114 payload: AxisTriggerPayload,
115 ecModel: GlobalModel,
116 api: ExtensionAPI
117) {
118 const currTrigger = payload.currTrigger;
119 let point = [payload.x, payload.y];
120 const finder = payload;
121 const dispatchAction = payload.dispatchAction || bind(api.dispatchAction, api);
122 const coordSysAxesInfo = (ecModel.getComponent('axisPointer') as AxisPointerModel)
123 .coordSysAxesInfo as CollectedCoordInfo;
124
125 // Pending
126 // See #6121. But we are not able to reproduce it yet.
127 if (!coordSysAxesInfo) {
128 return;
129 }
130
131 if (illegalPoint(point)) {
132 // Used in the default behavior of `connection`: use the sample seriesIndex
133 // and dataIndex. And also used in the tooltipView trigger.
134 point = findPointFromSeries({
135 seriesIndex: finder.seriesIndex,
136 // Do not use dataIndexInside from other ec instance.
137 // FIXME: auto detect it?
138 dataIndex: finder.dataIndex
139 }, ecModel).point;
140 }
141 const isIllegalPoint = illegalPoint(point);
142
143 // Axis and value can be specified when calling dispatchAction({type: 'updateAxisPointer'}).
144 // Notice: In this case, it is difficult to get the `point` (which is necessary to show
145 // tooltip, so if point is not given, we just use the point found by sample seriesIndex
146 // and dataIndex.
147 const inputAxesInfo = finder.axesInfo;
148
149 const axesInfo = coordSysAxesInfo.axesInfo;
150 const shouldHide = currTrigger === 'leave' || illegalPoint(point);
151 const outputPayload = {} as AxisTriggerPayload;
152
153 const showValueMap: ShowValueMap = {};
154 const dataByCoordSys: DataByCoordSysCollection = {
155 list: [],
156 map: {}
157 };
158 const updaters = {
159 showPointer: curry(showPointer, showValueMap),
160 showTooltip: curry(showTooltip, dataByCoordSys)
161 };
162
163 // Process for triggered axes.
164 each(coordSysAxesInfo.coordSysMap, function (coordSys, coordSysKey) {
165 // If a point given, it must be contained by the coordinate system.
166 const coordSysContainsPoint = isIllegalPoint || coordSys.containPoint(point);
167
168 each(coordSysAxesInfo.coordSysAxesInfo[coordSysKey], function (axisInfo, key) {
169 const axis = axisInfo.axis;
170 const inputAxisInfo = findInputAxisInfo(inputAxesInfo, axisInfo);

Callers

nothing calls this directly

Calls 14

illegalPointFunction · 0.85
findPointFromSeriesFunction · 0.85
findInputAxisInfoFunction · 0.85
processOnAxisFunction · 0.85
makeMapperParamFunction · 0.85
updateModelActuallyFunction · 0.85
dispatchTooltipActuallyFunction · 0.85
dispatchHighDownActuallyFunction · 0.85
getComponentMethod · 0.80
mapperMethod · 0.80
containPointMethod · 0.65
pointToDataMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…