Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a tooltip to plots with long titles that are cut by Vega #4840

Merged
merged 3 commits into from
Oct 17, 2023

Conversation

sroy3
Copy link
Contributor

@sroy3 sroy3 commented Oct 16, 2023

Demo

Screen.Recording.2023-10-16.at.11.47.41.AM.mov

@sroy3 sroy3 added the product PR that affects product label Oct 16, 2023
@sroy3 sroy3 marked this pull request as ready for review October 16, 2023 17:22
export const ZoomablePlotWrapper: React.FC<
PropsWithChildren<ZoomablePlotWrapperProps>
> = ({ title, id, children }) => {
const isTitleCut = title?.indexOf('…') === 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL we aren't doing this in code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no wait.... we are doing this in code but you can bypass because the id is the title, got it

Copy link
Member

@mattseddon mattseddon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to extend this for any truncation when the big template update lands.

I.e tooltip could contain

Title: ${title}
y-axis: ${yLabel}
...

if any are truncated.

const isTitleCut = title?.indexOf('…') === 0

return isTitleCut ? (
<Tooltip content={id} placement="top" interactive>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please confirm that having a tooltip in place does not break the ability to zoom the plot 🙏🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not prevent from zooming the plot. There should also be a tooltip on the zoomed plot though. I'll add one there as well.

Copy link
Contributor

@julieg18 julieg18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@tapadipti
Copy link

Thanks @sroy3 for addressing this so promptly.
Quick comment: I feel like it would be helpful if all the plot titles (including short ones) have tooltips. Just so that the user realizes that the titles have tooltips. wdyt?

@sroy3
Copy link
Contributor Author

sroy3 commented Oct 17, 2023

We should be able to extend this for any truncation when the big template update lands.

I.e tooltip could contain

Title: ${title}
y-axis: ${yLabel}
...

if any are truncated.

I can do a follow up for this.

@sroy3
Copy link
Contributor Author

sroy3 commented Oct 17, 2023

Thanks @sroy3 for addressing this so promptly. Quick comment: I feel like it would be helpful if all the plot titles (including short ones) have tooltips. Just so that the user realizes that the titles have tooltips. wdyt?

I feel like this would pollute the UI without adding any real value. Especially if all your plots have short titles.

The tooltip appears instantly when hovering a plot with a title that's been cut off. It is a common UX pattern to hover to view missing information, I don't think people will feel lost about this.

@sroy3 sroy3 enabled auto-merge (squash) October 17, 2023 14:31
@codeclimate
Copy link

codeclimate bot commented Oct 17, 2023

Code Climate has analyzed commit 35121fa and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 95.0% (0.0% change).

View more on Code Climate.

@sroy3 sroy3 merged commit 8af6e5e into main Oct 17, 2023
3 checks passed
@sroy3 sroy3 deleted the tooltip-long-plot-title branch October 17, 2023 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants