mirror of
https://github.com/apache/superset.git
synced 2026-04-25 02:55:07 +00:00
fix: Tooltip no longer highlights hovered data series (#24756)
This commit is contained in:
committed by
GitHub
parent
341b8d41c5
commit
ac19f58cf6
@@ -45,6 +45,7 @@ export default function EchartsMixedTimeseries({
|
||||
emitCrossFilters,
|
||||
seriesBreakdown,
|
||||
onContextMenu,
|
||||
onFocusedSeries,
|
||||
xValueFormatter,
|
||||
xAxis,
|
||||
refs,
|
||||
@@ -123,6 +124,12 @@ export default function EchartsMixedTimeseries({
|
||||
const { seriesName, seriesIndex } = props;
|
||||
handleChange(seriesName, seriesIndex);
|
||||
},
|
||||
mouseout: () => {
|
||||
onFocusedSeries(null);
|
||||
},
|
||||
mouseover: params => {
|
||||
onFocusedSeries(params.seriesName);
|
||||
},
|
||||
contextmenu: async eventParams => {
|
||||
if (onContextMenu) {
|
||||
eventParams.event.stop();
|
||||
|
||||
@@ -121,6 +121,9 @@ export default function transformProps(
|
||||
inContextMenu,
|
||||
emitCrossFilters,
|
||||
} = chartProps;
|
||||
|
||||
let focusedSeries: string | null = null;
|
||||
|
||||
const {
|
||||
verboseMap = {},
|
||||
currencyFormats = {},
|
||||
@@ -576,7 +579,9 @@ export default function transformProps(
|
||||
? tooltipFormatter
|
||||
: tooltipFormatterSecondary,
|
||||
});
|
||||
rows.push(`<span style="opacity: 0.7">${content}</span>`);
|
||||
const contentStyle =
|
||||
key === focusedSeries ? 'font-weight: 700' : 'opacity: 0.7';
|
||||
rows.push(`<span style="${contentStyle}">${content}</span>`);
|
||||
});
|
||||
return rows.join('<br />');
|
||||
},
|
||||
@@ -627,6 +632,10 @@ export default function transformProps(
|
||||
: [],
|
||||
};
|
||||
|
||||
const onFocusedSeries = (seriesName: string | null) => {
|
||||
focusedSeries = seriesName;
|
||||
};
|
||||
|
||||
return {
|
||||
formData,
|
||||
width,
|
||||
@@ -641,6 +650,7 @@ export default function transformProps(
|
||||
seriesBreakdown: rawSeriesA.length,
|
||||
selectedValues: filterState.selectedValues || [],
|
||||
onContextMenu,
|
||||
onFocusedSeries,
|
||||
xValueFormatter: tooltipFormatter,
|
||||
xAxis: {
|
||||
label: xAxisLabel,
|
||||
|
||||
@@ -150,4 +150,5 @@ export type EchartsMixedTimeseriesChartTransformedProps =
|
||||
label: string;
|
||||
type: AxisType;
|
||||
};
|
||||
onFocusedSeries: (series: string | null) => void;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user