dash-core-components icon indicating copy to clipboard operation
dash-core-components copied to clipboard

feature suggestion: Slider should have value printed next to it

Open arsenovic opened this issue 7 years ago • 7 comments

the Slider should have an option to display the current value like ipywidgets sliders.

arsenovic avatar Aug 07 '18 15:08 arsenovic

You can do this yourself with a label and a callback if required. Agreed it would be nice to see integrated though.

mkhorton avatar Aug 08 '18 23:08 mkhorton

true. having a callback for every slider seems highly redundant.

arsenovic avatar Aug 09 '18 13:08 arsenovic

If you need it for every slider and plan to make a lot of them, you could write a function that creates the slider, slider label and callback all in one. So then you can just call your custom function to create the component group instead of dcc.Slider

mkhorton avatar Aug 09 '18 14:08 mkhorton

i thought the app.callback had to be present to run the app, meaning not generated dynamically with a function?

arsenovic avatar Aug 10 '18 11:08 arsenovic

Ideally, yes. But generating a callback within another function is fine and can still be done on the initial load / to create the initial layout (so it’s not dynamic in this sense).

But actual dynamic callbacks are also possible I believe, if you “suppress_callback_exceptions” in your app config.

On Fri, Aug 10, 2018 at 04:44, alex arsenovic [email protected] wrote:

i thought the app.callback had to be present to run the app, meaning not generated dynamically with a function?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/plotly/dash-core-components/issues/255#issuecomment-412058771, or mute the thread https://github.com/notifications/unsubscribe-auth/AC1rRA7x71eaRlcu-Yui6NlGcGfo7GAsks5uPXIxgaJpZM4VyWcJ .

mkhorton avatar Aug 10 '18 14:08 mkhorton

But actual dynamic callbacks are also possible I believe, if you “suppress_callback_exceptions” in your app config.

@mkhorton Have you tested that?

@arsenovic Back to original question: Creating helper functions for more complicated components is really working well. Just make function that returns dcc.Div with some more complicated children in it. For callbacks you can make it class rather than function and keep all id's in class level field. Then in place that you know is interpreted last you can create callbacks for all id's stored in that class:

>>> class MyClass:
...     i = []
...
>>> MyClass.i
[]
>>> MyClass.i += 'a'
>>> MyClass.i
['a']
>>> MyClass.i += 'b'
>>> MyClass.i
['a', 'b']

radekwlsk avatar Aug 13 '18 06:08 radekwlsk

I think this is a duplicate of #324. The current status is that the value can be shown with a tooltip (see example below), and that there is a plan for a "slider companion".

slider = Slider(..., tooltip={"always_visible": False, "placement": "top"})

almarklein avatar Nov 05 '20 09:11 almarklein