Title: rangeslider template bug (non-attribute inserted into layout instead of fullLayout) · Issue #6310 · plotly/plotly.js · GitHub
Open Graph Title: rangeslider template bug (non-attribute inserted into layout instead of fullLayout) · Issue #6310 · plotly/plotly.js
X Title: rangeslider template bug (non-attribute inserted into layout instead of fullLayout) · Issue #6310 · plotly/plotly.js
Description: When you add a rangeslider, its yaxis container gets _template: null inserted into the input (layout) object. This isn't an attribute, so it should only be inserted in the fullLayout object, not the layout object. https://codepen.io/alex...
Open Graph Description: When you add a rangeslider, its yaxis container gets _template: null inserted into the input (layout) object. This isn't an attribute, so it should only be inserted in the fullLayout object, not th...
X Description: When you add a rangeslider, its yaxis container gets _template: null inserted into the input (layout) object. This isn't an attribute, so it should only be inserted in the fullLayout object, no...
Opengraph URL: https://github.com/plotly/plotly.js/issues/6310
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"rangeslider template bug (non-attribute inserted into layout instead of fullLayout)","articleBody":"When you add a rangeslider, its `yaxis` container gets `_template: null` inserted into the input (`layout`) object. This isn't an attribute, so it should only be inserted in the `fullLayout` object, not the `layout` object.\r\n\r\nhttps://codepen.io/alexcjohnson/pen/vYjOvgJ\r\n\r\nThis doesn't cause problems directly in plotly.js, but it should be fixed here because it can cause problems in Dash if you reload a figure into Python after displaying it on the page, for example:\r\n\r\n```py\r\nfrom dash import Dash, dcc, html, callback, Input, Output, State\r\nimport random\r\nimport datetime\r\nimport plotly.graph_objects as go\r\n\r\napp = Dash(__name__)\r\n\r\napp.layout = html.Div([\r\n html.Div(style={'display': 'flex'}, children=[\r\n dcc.Graph(\r\n id='graph-ph',\r\n figure={\r\n 'data': [\r\n {'x': [],\r\n 'y': [0, random.random()],\r\n 'mode':'lines+markers',\r\n }],\r\n 'layout': {\r\n 'title': 'pH (pH)'\r\n }},\r\n ),\r\n]),\r\n dcc.Interval(\r\n id='interval-graph-update',\r\n interval=3000,\r\n max_intervals=3),\r\n])\r\n\r\n@callback(\r\n Output('graph-ph', 'figure'),\r\n Input('interval-graph-update', 'n_intervals'),\r\n State('graph-ph', 'figure')\r\n )\r\ndef update_extend_traces_traceselect(n_intervals, fig_raw):\r\n x_new = datetime.datetime.now()\r\n y_new = random.random()\r\n\r\n fig_raw['data'][0]['x'] = fig_raw['data'][0]['x'] + [x_new]\r\n fig_raw['data'][0]['y'] = fig_raw['data'][0]['y'] + [y_new]\r\n\r\n fig = go.Figure(fig_raw)\r\n fig.update_xaxes(rangeslider={'visible': True})\r\n\r\n return fig\r\n\r\nif __name__ == '__main__':\r\n app.run_server(debug=True)\r\n```\r\n\r\nWhich gives the error (from the line `fig = go.Figure(fig_raw)` on the second callback call):\r\n```\r\nValueError: Invalid property specified for object of type\r\nplotly.graph_objs.layout.xaxis.rangeslider.YAxis: '_template'\r\n```\r\n\r\nUntil this is fixed, removing the problematic container (you could even remove just `_template`) can avoid the error:\r\n```py\r\n # add these lines before fig = go.Figure(fig_raw)\r\n if 'rangeslider' in fig_raw['layout']['xaxis']:\r\n del fig_raw['layout']['xaxis']['rangeslider']['yaxis']\r\n```","author":{"url":"https://github.com/alexcjohnson","@type":"Person","name":"alexcjohnson"},"datePublished":"2022-09-06T14:24:32Z","url":"https://github.com/plotly/plotly.js/issues/6310"}
| 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:e6040afb-277d-7a2d-9e1d-0e687b4f7734 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DB58:1F2F:BA6B27:F8862D:6B01AD61 |
| html-safe-nonce | ec470137932efbe294991bd8c07eae39ee997687d4cc0efa74d534edccd2a8a7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjU4OjFGMkY6QkE2QjI3OkY4ODYyRDo2QjAxQUQ2MSIsInZpc2l0b3JfaWQiOiI3NzUyMjEwMDI3MzkzNDI4ODMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 93c1fb5f3e3fd9831b0668decf106e04d32d6108afe41d69407fa8401774c3f3 |
| hovercard-subject-tag | issue:1363372414 |
| 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/6310/issue_layout |
| twitter:image | https://opengraph.githubassets.com/51f736d695b228bbdeb033d3d736f4f1d8906a5cdb0646dc4fbd0026c6769cc0/plotly/plotly.js/issues/6310 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/51f736d695b228bbdeb033d3d736f4f1d8906a5cdb0646dc4fbd0026c6769cc0/plotly/plotly.js/issues/6310 |
| og:image:alt | When you add a rangeslider, its yaxis container gets _template: null inserted into the input (layout) object. This isn't an attribute, so it should only be inserted in the fullLayout object, not th... |
| 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 | 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