I’m trying to get an idea on how to achieve this task. I created multiple sliders connected to multiple datatables.
Each slider queries selected dates data from a specific collection (MongoDB)
Right now my sliders works just fine.
This is how it works:
#define database.
database = client["signals"]
#define collections
daily_signals = database["daily_signals"]
days3 = database["3d_signals"]
#query dates as a dataframe for slider marks.
dfd = pd.DataFrame(daily_signals.distinct("Date"), columns=['Date'])
df3d = pd.DataFrame(days3.distinct("Date"), columns=['Date'])
numdate = [x for x in range(len(dfd['Date'].unique()))]
numdate3d = [x for x in range(len(df3d['Date'].unique()))]
app = Dash(__name__)
#sliders
app.layout = html.Div([
dcc.Slider(min=numdatem[0], #the first date
max=numdatem[-1], #the last date
value=numdatem[0], #default: the first
marks = {numd:date.strftime('%m') for numd,date in zip(numdatew, dfm['Date'].dt.date.unique())},
step=None,
included=False
),
dcc.Slider(min=numdate2w[0], #the first date
max=numdate2w[-1], #the last date
value=numdate2w[0], #default: the first
marks = {numd:date.strftime('%d/%m') for numd,date in zip(numdatew, df2w['Date'].dt.date.unique())},
step=None,
included=False
),])
#Calbacks and functions to create datatables etc.
if __name__ == '__main__':
app.run_server(debug=True)
There are five different timeframes D,3D,W,2W,M. I only added 2 of them here.
What i want to achieve is something like a vintage radio slider but it will more look like a calender which only shows workdays with periods of daily, 3 days, weekly, 2 weeks and monthly periods.
Somehow other slider marks must be aligned with daily sliders marks and each slider should be independent.
I don’t know where to look or where to start.
Thanks in advance.