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

Function dispatchHighDownActually

src/component/axisPointer/axisTrigger.ts:450–505  ·  view source on GitHub ↗
(
    axesInfo: Dictionary<CollectedAxisInfo>,
    dispatchAction: ExtensionAPI['dispatchAction'],
    api: ExtensionAPI
)

Source from the content-addressed store, hash-verified

448}
449
450function dispatchHighDownActually(
451 axesInfo: Dictionary<CollectedAxisInfo>,
452 dispatchAction: ExtensionAPI['dispatchAction'],
453 api: ExtensionAPI
454) {
455 // FIXME
456 // highlight status modification should be a stage of main process?
457 // (Consider conflict (e.g., legend and axisPointer) and setOption)
458
459 const zr = api.getZr();
460 const highDownKey = 'axisPointerLastHighlights' as const;
461 const lastHighlights = inner(zr)[highDownKey] || {};
462 const newHighlights: Dictionary<BatchItem> = inner(zr)[highDownKey] = {};
463
464 // Update highlight/downplay status according to axisPointer model.
465 // Build hash map and remove duplicate incidentally.
466 each(axesInfo, function (axisInfo, key) {
467 const option = axisInfo.axisPointerModel.option;
468 option.status === 'show' && axisInfo.triggerEmphasis && each(option.seriesDataIndices, function (batchItem) {
469 newHighlights[batchItem.seriesIndex + '|' + batchItem.dataIndex] = batchItem;
470 });
471 });
472
473 // Diff.
474 const toHighlight: Pick<BatchItem, 'seriesIndex' | 'dataIndex'>[] = [];
475 const toDownplay: Pick<BatchItem, 'seriesIndex' | 'dataIndex'>[] = [];
476 function makeHighDownItem(batchItem: BatchItem) {
477 // `dataIndexInside` should be removed, since the last recorded `dataIndexInside` may have
478 // been changed if `dataZoomInside` changed the view. Only `dataIndex` will suffice.
479 return {
480 seriesIndex: batchItem.seriesIndex,
481 dataIndex: batchItem.dataIndex,
482 };
483 }
484 each(lastHighlights, function (batchItem, key) {
485 !newHighlights[key] && toDownplay.push(makeHighDownItem(batchItem));
486 });
487 each(newHighlights, function (batchItem, key) {
488 !lastHighlights[key] && toHighlight.push(makeHighDownItem(batchItem));
489 });
490
491 toDownplay.length && api.dispatchAction({
492 type: 'downplay',
493 escapeConnect: true,
494 // Not blur others when highlight in axisPointer.
495 notBlur: true,
496 batch: toDownplay
497 } as DownplayPayload);
498 toHighlight.length && api.dispatchAction({
499 type: 'highlight',
500 escapeConnect: true,
501 // Not blur others when highlight in axisPointer.
502 notBlur: true,
503 batch: toHighlight
504 } as HighlightPayload);
505}
506
507function findInputAxisInfo(

Callers 1

axisTriggerFunction · 0.85

Calls 5

innerFunction · 0.85
makeHighDownItemFunction · 0.85
dispatchActionMethod · 0.80
getZrMethod · 0.65
eachFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…