feat: Funnel/tooltip-customization (#25666)

This commit is contained in:
Corbin Bullard
2023-10-19 14:04:29 -04:00
committed by GitHub
parent da42bf2dbb
commit dfff3c1cba
3 changed files with 51 additions and 6 deletions

View File

@@ -64,6 +64,7 @@ export function formatFunnelLabel({
const name = sanitizeName ? sanitizeHtml(rawName) : rawName;
const formattedValue = numberFormatter(value as number);
const formattedPercent = percentFormatter((percent as number) / 100);
switch (labelType) {
case EchartsFunnelLabelTypeType.Key:
return name;
@@ -93,7 +94,6 @@ export default function transformProps(
queriesData,
width,
theme,
inContextMenu,
emitCrossFilters,
datasource,
} = chartProps;
@@ -107,6 +107,7 @@ export default function transformProps(
gap,
labelLine,
labelType,
tooltipLabelType,
legendMargin,
legendOrientation,
legendType,
@@ -114,6 +115,8 @@ export default function transformProps(
numberFormat,
currencyFormat,
showLabels,
inContextMenu,
showTooltipLabels,
showLegend,
sliceId,
}: EchartsFunnelFormData = {
@@ -227,13 +230,13 @@ export default function transformProps(
},
tooltip: {
...getDefaultTooltip(refs),
show: !inContextMenu,
show: !inContextMenu && showTooltipLabels,
trigger: 'item',
formatter: (params: any) =>
formatFunnelLabel({
params,
numberFormatter,
labelType: EchartsFunnelLabelTypeType.KeyValuePercent,
labelType: tooltipLabelType,
}),
},
legend: {