diff --git a/src/chart/radar/RadarSeries.ts b/src/chart/radar/RadarSeries.ts index 1405ac074b..a231228c43 100644 --- a/src/chart/radar/RadarSeries.ts +++ b/src/chart/radar/RadarSeries.ts @@ -71,6 +71,10 @@ export interface RadarSeriesOption data?: (RadarSeriesDataItemOption | RadarSeriesDataValue)[] } +export interface RadarCallbackDataParams extends CallbackDataParams { + indicatorIndex: number, + indicatorName:string +} class RadarSeriesModel extends SeriesModel { @@ -102,6 +106,21 @@ class RadarSeriesModel extends SeriesModel { }); } + /** + * @overwrite + */ + getDataParams(dataIndex: number, dataType: any, el?: Element): RadarCallbackDataParams { + const params = super.getDataParams(dataIndex) as RadarCallbackDataParams; + // indicatorIndex && indicatorName + const indicatorIndex = (el && (el as any).__dimIdx) !== undefined ? (el as any).__dimIdx : null; + if (indicatorIndex != null) { + const indicatorAxis = this.coordinateSystem.getIndicatorAxes()[indicatorIndex]; + params.indicatorIndex = indicatorIndex; + params.indicatorName = indicatorAxis.name; + } + return params; + } + formatTooltip( dataIndex: number, multipleSeries?: boolean, diff --git a/src/component/tooltip/TooltipView.ts b/src/component/tooltip/TooltipView.ts index d5bf5d8f21..9a79846dd3 100644 --- a/src/component/tooltip/TooltipView.ts +++ b/src/component/tooltip/TooltipView.ts @@ -673,8 +673,8 @@ class TooltipView extends ComponentView { if (tooltipTrigger != null && tooltipTrigger !== 'item') { return; } - - const params = dataModel.getDataParams(dataIndex, dataType); + const el = e.target; + const params = dataModel.getDataParams(dataIndex, dataType, el); const markupStyleCreator = new TooltipMarkupStyleCreator(); // Pre-create marker style for makers. Users can assemble richText // text in `formatter` callback and use those markers style. diff --git a/test/radar-axis-indicatorIndex.html b/test/radar-axis-indicatorIndex.html new file mode 100644 index 0000000000..d3f01319c3 --- /dev/null +++ b/test/radar-axis-indicatorIndex.html @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +