fix: Time-series Line Chart Display unnecessary total (#31181)

This commit is contained in:
Michael S. Molina
2024-11-27 15:29:09 -03:00
committed by GitHub
parent f0811c8863
commit dbcb473040
3 changed files with 45 additions and 5 deletions

View File

@@ -210,9 +210,40 @@ const tooltipSortByMetricControl: ControlSetItem = {
},
};
const tooltipTotalControl: ControlSetItem = {
name: 'showTooltipTotal',
config: {
type: 'CheckboxControl',
label: t('Show total'),
renderTrigger: true,
default: true,
description: t('Whether to display the total value in the tooltip'),
visibility: ({ controls, form_data }: ControlPanelsContainerProps) =>
Boolean(controls?.rich_tooltip?.value) &&
form_data.viz_type !== 'mixed_timeseries',
},
};
const tooltipPercentageControl: ControlSetItem = {
name: 'showTooltipPercentage',
config: {
type: 'CheckboxControl',
label: t('Show percentage'),
renderTrigger: true,
default: true,
description: t('Whether to display the percentage value in the tooltip'),
visibility: ({ controls, form_data }: ControlPanelsContainerProps) =>
Boolean(controls?.rich_tooltip?.value) &&
!controls?.contributionMode?.value &&
form_data.viz_type !== 'mixed_timeseries',
},
};
export const richTooltipSection: ControlSetRow[] = [
[<ControlSubSectionHeader>{t('Tooltip')}</ControlSubSectionHeader>],
[richTooltipControl],
[tooltipTotalControl],
[tooltipPercentageControl],
[tooltipSortByMetricControl],
[tooltipTimeFormatControl],
];