RangeSlider callback

Hi guys. Is there a means of applying a RangeSlider call back to the whole dataset after filtering , so that it affects all the graphs and other time series component of your dashboard rather than applying it to each single graph. I want to be able to apply the start and end month to my whole dashboard.

value=[3, 7],
1: “January”,
2: “February”,
3: “March”,
4: “April”,
5: “May”,
6: “June”,
7: “July”,
8: “August”,
9: “September”,
10: “October”,
11: “November”,
12: “December”,

which component do i need to pass my callback on and how do i script the callback.Any help?

At a high level, you can have the range slider callback output your filtered data set to a hidden Div or dcc.Store. You can then have the callbacks that handle your graphs trigger on the change to this dataset.

1 Like

I did something similar but for some reasons i cant get the callback to do any actions when i use my rangeSlider.

Here is my code:

Defining filter:

def filter_dataframe(month_slider):
    return dff



                    value=[3, 7],
                        1: "January",
                        2: "february",
                        3: "March",
                        4: "April",
                        5: "May",
                        6: "June",
                        7: "July",
                        8: "August",
                        9: "September",
                        10: "October",
                        11: "November",
                        12: "December",


def update_dataframe(range_slider):
    return df

It took me a hot second but your callback has range_slider but your range slider was created with id=range-slider…dash vs underscore.

Thanks for the correction @flyingcujo. That still is not the issue with the code. Cant get it to filter my dataframe on my graphs when i use the rangeSlider.

where is df defined? Is this a global variable? For debugging, can you provide a sample df?

Hi @flyingcujo. I defined my df out of the app.layout, pivoted it to get the my pivots,defined all my traces for my graphs and then just called them within the app.layout. Should the call back for my dcc.Store be called first , or do i need to define and create all my pivots and traces within the app.layout??

I only have layout code in my layout.py file, just to keep it separate from my callbacks. As long as all your componts are defined prior to invoking app.server, it really doesn’t matter where you callbacks, layout, etc are located.

Per the FAQ:

All your callbacks must be defined before your Dash app’s server starts running, which is to say, before you call app.run_server(debug=True)

Regarding the calling order of your callbacks, it all depends on whether or not you have components “chained”, i.e. user pressing component 1 when then triggers callback A, whose outtput triggers callback B, etc.