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

Tooltip: First attempt to get tooltip in bounds anyway #107

Merged

Conversation

louismaximepiton
Copy link
Member

@louismaximepiton louismaximepiton commented Feb 2, 2024

Related issues

Closes #99

Description

This PR introduces a new experimental ODSChartsPopoverConfig property named tooltipConfine. This property is to be used instead of the tooltip.confine property in the echarts options to have a better control over the tooltip position, and make it stay within the chart area.

It also changes the arrow position of the tooltip to follow the mouse position.

Types of change

  • New feature (non-breaking change which adds functionality)

Copy link

netlify bot commented Feb 2, 2024

Deploy Preview for ods-charts ready!

Name Link
🔨 Latest commit 4689d00
🔍 Latest deploy log https://app.netlify.com/sites/ods-charts/deploys/65e1887014183f00081ac3b9
😎 Deploy Preview https://deploy-preview-107--ods-charts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

if (this.popoverConfig.tooltipConfine) {
const x = pos[0];
const arrowSize = 10;
const bottom = pos[1] > size.contentSize[1]; // pos[1] > size.viewSize[1] / 2 or pos[1] > size.contentSize[1] or pos[1] > size.viewSize[1] - size.contentSize[1]
Copy link
Member

Choose a reason for hiding this comment

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

Future reader, please note that there's a possibility to change the rendering by doing:

// pos[1] > size.viewSize[1] / 2 or pos[1] > size.contentSize[1] or pos[1] > size.viewSize[1] - size.contentSize[1]

@julien-deramond julien-deramond marked this pull request as ready for review March 1, 2024 07:54
@julien-deramond julien-deramond self-requested a review March 1, 2024 07:54
Copy link
Member

@julien-deramond julien-deramond left a comment

Choose a reason for hiding this comment

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

We spotted some issues when tooltip.confine and tooltipConfine are defined and with different values but it should be an issue since we recommend using only tooltipConfine; it's going to be treated as a separate issue. LGTM!

@julien-deramond julien-deramond merged commit 5d8a0d9 into Orange-OpenSource:main Mar 1, 2024
5 checks passed
Copy link
Member

@jacques-lebourgeois jacques-lebourgeois left a comment

Choose a reason for hiding this comment

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

Looks fine for me

@louismaximepiton louismaximepiton deleted the main-lmp-popover-fix branch March 4, 2024 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The tooltip or popover is displayed outside the graph and can be partially hidden.
3 participants