apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.34k stars 13.69k forks source link

Table Chart - Line "totals" without tooltip to show the real/exact value #28385

Open jose-l-goncalves-alb opened 5 months ago

jose-l-goncalves-alb commented 5 months ago

Bug description

I have a table chart with the "SHOW TOTALS" option enabled. The column values of line "Totals" does not show a tooltip (mouse over) with the value. The value is showed as 346M , but the tooltip does not apear to show the real/exact value. Nevertheless the metric values of cells table, as we can see (image below), have a tooltip associated (with the real/exact value).

How to reproduce the bug

  1. Create a chart table
  2. Enable "SHOW TOTALS" option
  3. Generate the table with metrics values greater than 1000
  4. Check if exist a tooltip at a "totals" metric value (ex.: 12M). The tooltip should show the real/exact value

Screenshots/recordings

table-chart-tooltip-but-not-at-totals-metric

Superset version

3.1.2

Python version

3.10

Node version

Not applicable

Browser

Chrome

Additional context

No response

Checklist

dosubot[bot] commented 5 months ago

The issue you're encountering with the tooltip not appearing for the "totals" row in a table chart in Superset version 3.1.2 seems to be related to how the tooltip functionality is implemented for this specific part of the table. The tooltip functionality for individual cells is handled through the tooltipHtml function, which generates the HTML content for tooltips. This function is part of the superset-frontend/packages/superset-ui-core/src/utils/tooltip.ts file and is designed to work across different chart types, including table charts. However, it does not include specific functionality or configuration options to enable tooltips for the "totals" row.

The rendering of the "totals" row and its configuration is managed within the TableChart.tsx file, under the getColumnConfigs function, particularly in the Footer property of the column configuration object. Modifications might be required here to ensure that the "totals" row is equipped with the necessary logic to display tooltips, similar to how individual cells handle mouseover events to show tooltips.

For addressing this issue, you might need to look into how the "totals" row is rendered differently from other cells and ensure that it has event listeners attached for displaying tooltips. This could involve updating the component responsible for the "totals" row to include tooltip functionality explicitly.

Additionally, the show_totals control configuration found in the superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx file adds a checkbox option labeled "Show totals" for displaying total aggregations of selected metrics. While this control enables the display of totals, it does not directly address the tooltip functionality for these totals, indicating that further customization might be necessary to achieve the desired tooltip behavior for the "totals" row.

This information should help you understand the potential cause of the tooltip issue with the "totals" row and guide you towards areas of the codebase that might require adjustments.

#### Details **Sources** - [Add "Total" values on hover tooltips whenever "GROUP BY" is used](https://github.com/apache/superset/issues/15561) - [superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx) - [superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx) - [superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.js](https://github.com/apache/superset/blob/master/superset-frontend/plugins/legacy-preset-chart-nvd3/src/utils.js) - [superset-frontend/packages/superset-ui-core/test/chart-composition/tooltip/TooltipTable.test.tsx](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/test/chart-composition/tooltip/TooltipTable.test.tsx) - [superset-frontend/packages/superset-ui-core/src/utils/tooltip.ts](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/utils/tooltip.ts) - [superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx) - [CHANGELOG/1.5.0.md](https://github.com/apache/superset/blob/master/CHANGELOG/1.5.0.md)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.