Skip to content
Advertisement

Dash chart does not display default dropdown value selection upon page load and refresh

I’m just getting to grips with Dash but am coming across a problem I can’t resolve. I am trying to pass a default dropdown value to a line chart upon page load, but even though the value is present in the dropdown menu it doesn’t render in the chart:

enter image description here

As soon as I select another country (region) though, the chart works as expected: enter image description here

How do I get the chart to load with my default dropdown value (England)? Here’s the code:

JavaScript

Thanks!

Advertisement

Answer

The ‘value’ attribute of the dropdown component has to be a list instead of string while setting multi as True. Just wrap the square brackets around the value as follows and you should be good to go:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement