Skip to content

Commit

Permalink
feat(radar): Radar series tooltip support dimensionIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
AielloChan committed Jan 11, 2025
1 parent c09cab5 commit 12cfeaa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/component/tooltip/TooltipView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ class TooltipView extends ComponentView {
params.marker = markupStyleCreator.makeTooltipMarker(
'item', convertToColorString(params.color), renderMode
);
params.dimensionIndex = dispatcher.__dimIdx;

const seriesTooltipResult = normalizeTooltipFormatResult(
dataModel.formatTooltip(dataIndex, false, dataType)
Expand Down
6 changes: 4 additions & 2 deletions src/core/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1067,14 +1067,15 @@ class ECharts extends Eventful<ECEventDefinition> {
const handler = (e: ElementEvent) => {
const ecModel = this.getModel();
const el = e.target;
let dispatcher: ECElement | undefined;
let params: ECElementEvent;
const isGlobalOut = eveName === 'globalout';
// no e.target when 'globalout'.
if (isGlobalOut) {
params = {} as ECElementEvent;
}
else {
el && findEventDispatcher(el, (parent) => {
else if (el) {
dispatcher = findEventDispatcher(el, (parent) => {
const ecData = getECData(parent);
if (ecData && ecData.dataIndex != null) {
const dataModel = ecData.dataModel || ecModel.getSeriesByIndex(ecData.seriesIndex);
Expand Down Expand Up @@ -1131,6 +1132,7 @@ class ECharts extends Eventful<ECEventDefinition> {

params.event = e;
params.type = eveName;
params.dimensionIndex = dispatcher ? dispatcher.__dimIdx : undefined;

(this._$eventProcessor as ECEventProcessor).eventInfo = {
targetEl: el,
Expand Down
5 changes: 5 additions & 0 deletions src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ export interface ECElement extends Element {
* Force disable morphing
*/
disableMorphing?: boolean

/**
* From RadarSymbol
*/
__dimIdx?: number;
}

export interface DataHost {
Expand Down

0 comments on commit 12cfeaa

Please sign in to comment.