Make notify-on-logging work with newPlot
See original GitHub issueRight now we can’t use this function from Python because we only set config
during newPlot
.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Function reference in JavaScript - Plotly
Draws a new plot in an <div> element, overwriting any existing plot. To update an existing plot in a <div> , it is...
Read more >plotly.js-dist | Yarn - Package Manager
... Add notifyOnLogging config option that allows log/warn/error messages to show up ... Make Plots.resize work when layout attribute is gone from graph...
Read more >Source - GitHub
Rework `matches` and `scaleanchor` so they work together ... Add `notifyOnLogging` config option that allows log/warn/error messages to show up in notifiers ...
Read more >CHANGELOG.md · res5692-no-longer-latest-cdn · mirrors / plotly ...
Rework matches and scaleanchor so they work together [#5287] ... Add notifyOnLogging config option that allows log/warn/error messages to show up in ...
Read more >plotly Changelog - PyUp.io
Made the Plotly Express `trendline` argument more robust and made it work with ... Add `notifyOnLogging` config option that allows log/warn/error messages
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Currently, the
loggers.js
module requires the default plot config object:https://github.com/plotly/plotly.js/blob/8f049fddbac0ca0382816984b8526857e9714fe6/src/lib/loggers.js#L13
and uses it to determine which log to show in the console and/or the notifier popups.
The default plot config object can be mutated using
Plotly.setPlotConfig
:https://github.com/plotly/plotly.js/blob/8f049fddbac0ca0382816984b8526857e9714fe6/src/plot_api/plot_api.js#L402-L404
and this is the only way to get the
logging
andnotifyOnLogging
config option to work at the moment.Routines that depend on the other config options do not rely on the default plot config object; they instead rely on the “graph” config (i.e context) coerced in
gd._context
duringhttps://github.com/plotly/plotly.js/blob/8f049fddbac0ca0382816984b8526857e9714fe6/src/plot_api/plot_api.js#L419-L524
So, to make the
loggers.js
know aboutgd._context
, we’ll need to passgd
to allLib.log
,Lib.warn
andLib.error
calls. For example,Things might get annoying for cases when
gd
isn’t part of the scope in whichLib.(log|warn|error)
is called from. Perhaps to make things easier to pass around, we could copy thelogging
andnotifyOnLogging
keys infullLayout
.Note also, that queue module also uses the default plot config object:
https://github.com/plotly/plotly.js/blob/8f049fddbac0ca0382816984b8526857e9714fe6/src/lib/queue.js#L12
https://github.com/plotly/plotly.js/blob/8f049fddbac0ca0382816984b8526857e9714fe6/src/lib/queue.js#L91-L94
This thing is mostly deprecated, but maybe it would be a good idea to make it work with
gd._context
as well.We already have a
config
option for this, so all that’s needed is for it to work when set inline withnewPlot
😃