Title: Fixed-width hover labels with `hoverlabel.width` · Issue #3800 · plotly/plotly.js · GitHub
Open Graph Title: Fixed-width hover labels with `hoverlabel.width` · Issue #3800 · plotly/plotly.js
X Title: Fixed-width hover labels with `hoverlabel.width` · Issue #3800 · plotly/plotly.js
Description: So I've set up my graph to have a fixed width for hover labels, and it was a real PITA to get to this now, I'm using the angular library, but basically, I set a manual tbbwidth in createHoverText, changing var tbb = tx.node().getBounding...
Open Graph Description: So I've set up my graph to have a fixed width for hover labels, and it was a real PITA to get to this now, I'm using the angular library, but basically, I set a manual tbbwidth in createHoverText, ...
X Description: So I've set up my graph to have a fixed width for hover labels, and it was a real PITA to get to this now, I'm using the angular library, but basically, I set a manual tbbwidth in createHov...
Opengraph URL: https://github.com/plotly/plotly.js/issues/3800
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fixed-width hover labels with `hoverlabel.width`","articleBody":"So I've set up my graph to have a fixed width for hover labels, and it was a real PITA to get to this now,\r\n\r\n\u003cimg width=\"608\" alt=\"Screen Shot 2019-04-23 at 03 03 40\" src=\"https://user-images.githubusercontent.com/955114/56547283-d6734100-6574-11e9-97aa-26bcce9be17e.png\">\r\n\u003cimg width=\"565\" alt=\"Screen Shot 2019-04-23 at 03 03 47\" src=\"https://user-images.githubusercontent.com/955114/56547284-d6734100-6574-11e9-91fb-0f31f9908b99.png\">\r\n\r\nI'm using the angular library, but *basically*, I set a manual tbbwidth in `createHoverText`, changing\r\n\r\n var tbb = tx.node().getBoundingClientRect();\r\n var htx = d.xa._offset + (d.x0 + d.x1) / 2;\r\n var hty = d.ya._offset + (d.y0 + d.y1) / 2;\r\n var dx = Math.abs(d.x1 - d.x0);\r\n var dy = Math.abs(d.y1 - d.y0);\r\n var txTotalWidth = tbb.width + HOVERARROWSIZE + HOVERTEXTPAD + tx2width;\r\n var anchorStartOK, anchorEndOK;\r\n\r\n d.ty0 = outerTop - tbb.top;\r\n d.bx = tbb.width + 2 * HOVERTEXTPAD;\r\n d.by = Math.max(tbb.height + 2 * HOVERTEXTPAD, tx2height);\r\n d.anchor = 'start';\r\n d.txwidth = tbb.width;\r\n d.tx2width = tx2width;\r\n d.offset = 0;\r\n\r\nTo,\r\n\r\n var tbb = tx.node().getBoundingClientRect();\r\n var htx = d.xa._offset + (d.x0 + d.x1) / 2;\r\n var hty = d.ya._offset + (d.y0 + d.y1) / 2;\r\n var dx = Math.abs(d.x1 - d.x0);\r\n var dy = Math.abs(d.y1 - d.y0);\r\n var tbbwidth = 385;\r\n var txTotalWidth = tbbwidth + HOVERARROWSIZE + HOVERTEXTPAD + tx2width;\r\n var anchorStartOK, anchorEndOK;\r\n\r\n d.tbbwidth = tbb.width;\r\n d.ty0 = outerTop - tbb.top;\r\n d.bx = tbbwidth + 2 * HOVERTEXTPAD;\r\n d.by = Math.max(tbb.height + 2 * HOVERTEXTPAD, tx2height);\r\n d.anchor = 'start';\r\n d.txwidth = tbbwidth;\r\n d.tx2width = tx2width;\r\n d.offset = 0;\r\n\r\nAnd in `alignHoverText` (my local version is 1.45.3),\r\n\r\n tx.call(svgTextUtils.positionText,\r\n txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD);\r\n\r\nTo,\r\n\r\n tx.call(svgTextUtils.positionText,\r\n (txx \u003c 0 ? -(d.bx - d.tbbwidth) : txx) + offsetX, \r\n offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD);\r\n\r\n---\r\n\r\nI'd love to have this feature myself for graphs like this, and more - and would really appreciate some advice as to what would be the best method to submit a PR.","author":{"url":"https://github.com/seaders","@type":"Person","name":"seaders"},"datePublished":"2019-04-23T02:15:06Z","url":"https://github.com/plotly/plotly.js/issues/3800"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ceea5c91-73b3-503f-6256-df8ffbe82df8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 87EA:16EED3:2DA4F1A:3A27BEF:6B01BF0F |
| html-safe-nonce | 82045b314f9d334548814ce3e2dbb0496f15a5f3cab858df5374a30442c422e2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4N0VBOjE2RUVEMzoyREE0RjFBOjNBMjdCRUY6NkIwMUJGMEYiLCJ2aXNpdG9yX2lkIjoiMzk5NzQ0NjQwOTE2NjExMDQ3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 051fb50c52fe774b3019bce57de833a51e97e90e8229a2b9644c3ec9fbb92c04 |
| hovercard-subject-tag | issue:435966381 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/plotly/plotly.js/3800/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0686469bd87dbaa47574f8c9f895d2b7be2eabbd46269129c1d72d4741624914/plotly/plotly.js/issues/3800 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0686469bd87dbaa47574f8c9f895d2b7be2eabbd46269129c1d72d4741624914/plotly/plotly.js/issues/3800 |
| og:image:alt | So I've set up my graph to have a fixed width for hover labels, and it was a real PITA to get to this now, I'm using the angular library, but basically, I set a manual tbbwidth in createHoverText, ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | seaders |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.js git https://github.com/plotly/plotly.js.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 45646037 |
| octolytics-dimension-repository_nwo | plotly/plotly.js |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 45646037 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.js |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width