it was indeed the version xd, everything works great.
Hi, I’m trying to get rid of the undo/redo buttons, I can’t seem to find the argument, is that possible?
Thanks
There isn’t an argument for this yet, so for now you have to hide them with an external CSS stylesheet by setting
._dash-undo-redo {
display: none;
}
Amazing, thanks Chris!
Unfortunately for me, this feature added more pain than value. What I want is to set a global config that would apply to all charts, e.g. to remove the “send data to cloud” button. The correct way to do that was discussed in issue #316:
Plotly.setPlotConfig({
modeBarButtonsToRemove: ['sendDataToCloud']
});
The new feature, however sets all values which have not been explicitly provided by the Dash app itself to some defaults. For modeBarButtonsToRemove
that is an empty list, which effectively overrides my global defaults. That means that the only way for me to have this applied to all charts globally is via CSS. This clearly looks like a big issue to me. When no setting was explicitly by Dash app, the renderer should not assume it’s ok to override global defaults with some dummy values.
Which feature are you referring to? The Plotly.setPlotConfig
function or the dash dcc.Figure(config=...)
attribute?
It sounds like you are referring to the plotly.js issue with Plotly.setPlotConfig
? If so, could you open an issue in the GitHub - plotly/plotly.js: Open-source JavaScript charting library behind Plotly and Dash repo and discuss it with those maintainers?
Of course, the workaround right now is to apply your desired modebar on every graph that you use. You can always create your own component classes that provide the defaults that you want, like:
def GraphWithModeBar(**kwargs):
return dcc.Graph(config={'modeBarButtonsToRemove': ['sendDataToCloud']}, **kwargs)
Sorry, should have been more explicit. I was referring to Graph
Dash core component. If I understand correctly, it sets modeBarButtonsToRemove: []
when it hasn’t been explicitly set by our Dash application. As a result, this empty array overrides global config.
I want to be able to control global config with Plotly.setPlotConfig
but it simply has no effect because it gets overridden by a dummy empty array coming from Dash with each graph.
i how use this code? just put in app,py? look not good…
That code is CSS, so you need to add it to an external CSS style sheet. eg yourdash.css
. Which means you need to have added the file as an external CSS sheet:
app.css.append_css({“external_url”: “static/yourdash.css”)
Flask automatically serves files in the folder static
(at the root of your app), which is why that’s a good place to put it. Unfortunately adding CSS files to Dash this way means you can’t set app.css.config.serve_locally = True
Thank you for your reply, but there are still some problems
I created the static folder in the root directory, which added my.css
and change my.css
._dash-undo-redo {
display: none;
}
There’s still no response. The undo button is still there. I think CSS has no effect. Is it wrong?
Ah interesting. It seems that by default Dash is not setup to enable the static directory serving. I normally create my own Flask server and pass it in. Since Flask does it enable it by default that means you can so this:
server = Flask(__name__)
app = Dash(server=server)
Alternatively, you can create your Dash instance like this and it will also work:
app = Dash(name=__name__, static_folder='static')
(I’m not sure why the name argument is necessary, but the static route doesn’t work without it)
i try Annotate app.css.config.serve_locally = True. then check source code,have this css。but is 404 - _-!
You’ve uncommented out this line app.css.config.serve_locally = True
. My comment was that you can’t do that when adding CSS files this way. Just delete both those lines pertaining to CSS and scripts.
Also you don’t need that second line that creates another Dash() instance. I was giving you two different ways to create the Dash instance, you just need the first one.
thank very very much… i find long time the forum…
is okay now.
can u tell me how use about help code to see chart parameter information?
ples How can use HELP order?
For the undo/redo buttons part of this discussion: in Dash 1.0 these buttons are removed by default. If you actually want them, use app = Dash(show_undo_redo=True)
Would be nice if this could it find into the documentation and to be findable with the search tool.