Title: Better update pattern for cartesian SVG · Issue #2563 · plotly/plotly.js · GitHub
Open Graph Title: Better update pattern for cartesian SVG · Issue #2563 · plotly/plotly.js
X Title: Better update pattern for cartesian SVG · Issue #2563 · plotly/plotly.js
Description: As @etpinard pointed out during the finance refactor PR #2561 (comment) and #2561 (comment) we have a mess when redrawing cartesian SVG traces, both re: deleting and redrawing existing traces and re: removing completely unused modules. T...
Open Graph Description: As @etpinard pointed out during the finance refactor PR #2561 (comment) and #2561 (comment) we have a mess when redrawing cartesian SVG traces, both re: deleting and redrawing existing traces and r...
X Description: As @etpinard pointed out during the finance refactor PR #2561 (comment) and #2561 (comment) we have a mess when redrawing cartesian SVG traces, both re: deleting and redrawing existing traces and r...
Opengraph URL: https://github.com/plotly/plotly.js/issues/2563
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Better update pattern for cartesian SVG","articleBody":"As @etpinard pointed out during the finance refactor PR https://github.com/plotly/plotly.js/pull/2561#discussion_r181852562 and https://github.com/plotly/plotly.js/pull/2561#discussion_r181856275 we have a mess when redrawing cartesian SVG traces, both re: deleting and redrawing existing traces and re: removing completely unused modules.\r\n\r\nThe first part we can handle by making all the trace modules support more d3-idiomatic `enter/exit/each` logic as suggested in [this TODO](https://github.com/plotly/plotly.js/blob/82677ac8745ca56da740302977533dffcd5521b6/src/plots/cartesian/index.js#L201). The second has a few ways to go about it. Quoting @etpinard:\r\n\r\n\u003e What we need to do is find all the _gone_ modules (i.e. modules with `had??=true` and `has??=false`), loop over them, and then do what we need to do the cleanup the DOM. \r\n\u003e \r\n\u003e Better yet -- as more and more trace type will follow scatter and ohlc in not expecting a `selectAll('g.trace').remove()` before each `_module.plot()` -- we could add a trace module method (maybe called `cleanDOM`) to each trace modules that need to remove things for the DOM (or destroy WebGL objects). \r\n\u003e \r\n\u003e To note, geo subplots (and maybe others?) solve this problem in a different way by using `Plots.generalUpdatePerTraceModule` which calls `_module.plot` of visible **and** _gone_ modules and expects the trace module plot methods to clean up the DOM accordingly (e.g. like [here](https://github.com/plotly/plotly.js/blob/18e19a86a3e683c1d11f6f4a04eb7f89d1b6108f/src/traces/choropleth/plot.js#L34) for choropleth traces). At present though, I think adding `cleanDOM` to each trace module would be best, as it would allow us to handle the `scattergl` and range-slider cases more easily.","author":{"url":"https://github.com/alexcjohnson","@type":"Person","name":"alexcjohnson"},"datePublished":"2018-04-16T22:41:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/2563/plotly.js/issues/2563"}
| 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:e5535488-997a-4135-4a41-31ef0f1b2b99 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F3A:A5979:27F9193:3975737:6A566D04 |
| html-safe-nonce | 55de8470a15680fb10947ccf621867efeca66f4f72d468c544036e5a225866bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjNBOkE1OTc5OjI3RjkxOTM6Mzk3NTczNzo2QTU2NkQwNCIsInZpc2l0b3JfaWQiOiIyNzkwNDM0ODU5NTE2MzI1MTI0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 817041023ecd85ebacdf861c0fc70dc478c2f3918a7f7ab4dc3d0a10a64ea89b |
| hovercard-subject-tag | issue:314843312 |
| 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/2563/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1e6e279e7e4cdc74269f65190cca9c5d69062cb07e2ffd611b4d2051bcbcae28/plotly/plotly.js/issues/2563 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1e6e279e7e4cdc74269f65190cca9c5d69062cb07e2ffd611b4d2051bcbcae28/plotly/plotly.js/issues/2563 |
| og:image:alt | As @etpinard pointed out during the finance refactor PR #2561 (comment) and #2561 (comment) we have a mess when redrawing cartesian SVG traces, both re: deleting and redrawing existing traces and r... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alexcjohnson |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bfcd903bf3318822b10b18a6332fac40d3a21f7d94456dca766ab8fa7328068 |
| 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 | 37f446b78ad53e6f593aa1a4243b87c76a3428ab |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width