Shopify/polaris-viz

New default behaviour for tooltips during comparisons

philschoefer opened this issue · 1 comments

Feature request summary

Currently Polaris Viz renders the series name for tooltip labels. Each of the tooltip rows consists of the name of the series and the corresponding value at that point of the X-Axis.

This works well when comparing e.g. products:

Show Screenshot Screen Shot 2022-10-21 at 10 25 11 AM

Try in Storybook

However, as soon as one series is set to isComparison: true the output is lacking some information:

Show Screenshot Screen Shot 2022-10-21 at 10 21 35 AM

Try in Storybook

What day exactly had that amount of sales? In the tooltip we indicate that we're comparing against previous month data, but we never know what point in the past the displayed value is actually referring to. We also don't show that information in the X-Axis.

Rationale

Many places in the admin have worked around this limitation by creating custom tooltips that display the label of the activeIndex of the comparison data series instead. So instead of April 1-14 and Previous Period it would show the exact date for that specific data point.

Show Web Implementation Examples Screen Shot 2022-10-21 at 10 44 03 AM Screen Shot 2022-10-21 at 10 43 45 AM

Notebooks is about to hit this issue with ShopifyQLV2 introducing the COMPARE TO keyword: https://github.com/Shopify/core-issues/issues/47801

I think we should consider to update Polaris Viz tooltip default behaviour to switch into a different tooltip mode when isComparison is set on a series where the header disappears and instead of showing series names we display the label of the actual data point in the tooltip.

When this is implemented, we could also consider adding in the Trend indicator which is also commonly used where two values are compared against each other in a tooltip and currently needs to be custom implemented in every place we do comparisons in charts.


🌟 Feature requests that are not yet planned will be closed. We then use the issue’s 👍 upvotes to track and set priorities. See the contribution guidelines for more information.

Hey @philschoefer. Is there any update / options for this? Thanks