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

Function processOnAxis

src/component/axisPointer/axisTrigger.ts:213–257  ·  view source on GitHub ↗
(
    axisInfo: CollectedCoordInfo['axesInfo'][string],
    newValue: AxisValue,
    updaters: {
        showPointer: Curry1<typeof showPointer, ShowValueMap>
        showTooltip: Curry1<typeof showTooltip, DataByCoordSysCollection>
    },
    noSnap: boolean,
    outputFinder: ModelFinderObject
)

Source from the content-addressed store, hash-verified

211}
212
213function processOnAxis(
214 axisInfo: CollectedCoordInfo['axesInfo'][string],
215 newValue: AxisValue,
216 updaters: {
217 showPointer: Curry1<typeof showPointer, ShowValueMap>
218 showTooltip: Curry1<typeof showTooltip, DataByCoordSysCollection>
219 },
220 noSnap: boolean,
221 outputFinder: ModelFinderObject
222) {
223 const axis = axisInfo.axis;
224
225 if (axis.scale.isBlank() || !axis.containData(newValue)) {
226 return;
227 }
228
229 if (!axisInfo.involveSeries) {
230 updaters.showPointer(axisInfo, newValue);
231 return;
232 }
233
234 // Heavy calculation. So put it after axis.containData checking.
235 const payloadInfo = buildPayloadsBySeries(newValue, axisInfo);
236 const payloadBatch = payloadInfo.payloadBatch;
237 const snapToValue = payloadInfo.snapToValue;
238
239 // Fill content of event obj for echarts.connect.
240 // By default use the first involved series data as a sample to connect.
241 if (payloadBatch[0] && outputFinder.seriesIndex == null) {
242 extend(outputFinder, payloadBatch[0]);
243 }
244
245 // If no linkSource input, this process is for collecting link
246 // target, where snap should not be accepted.
247 if (!noSnap && axisInfo.snap) {
248 if (axis.containData(snapToValue) && snapToValue != null) {
249 newValue = snapToValue;
250 }
251 }
252
253 updaters.showPointer(axisInfo, newValue, payloadBatch);
254 // Tooltip should always be snapToValue, otherwise there will be
255 // incorrect "axis value ~ series value" mapping displayed in tooltip.
256 updaters.showTooltip(axisInfo, payloadInfo, snapToValue);
257}
258
259function buildPayloadsBySeries(value: AxisValue, axisInfo: CollectedAxisInfo) {
260 const axis = axisInfo.axis;

Callers 1

axisTriggerFunction · 0.85

Calls 3

buildPayloadsBySeriesFunction · 0.85
extendFunction · 0.85
containDataMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…