Currently I mainly use Dash Boostrap Components’s DateRangePicker when making Dash, but I find Dash Mantine’s month and year selection feature very good and plan to use it instead. But I don’t see the Start Date and End Date options like Dash Boostrap Components’s DateRangePicker to filter data. Something as below:
@callback([Output('sales_indicator', 'children'),
Output('revenues_indicator', 'children'),
Output('bottle_indicator', 'children'),
Output('liters_indicator', 'children')],
[Input('btn','n_clicks'),
Input(ThemeChangerAIO.ids.radio("theme"), "value")],
[State('my-date-picker-range', 'start_date'),
State('my-date-picker-range', 'end_date')])
def update_indicator(n_clicks,theme,start_date,end_date):
dff = df[(df['date'] >= start_date) & (df['date'] <= end_date)]
So with start_date and end_date I can filter data to create graph but with Dash Mantine I just see value option and I don’t know how to use it to filter data. Below is sample from Dash Mantine:
from datetime import datetime, timedelta, date
import dash_mantine_components as dmc
from dash import Input, Output, html, callback
from dash.exceptions import PreventUpdate
html.Div(
[
dmc.DateRangePicker(
id="date-range-picker",
label="Date Range",
description="You can also provide a description",
minDate=date(2020, 8, 5),
maxDate=date(2022, 9, 19),
value=[datetime.now().date(), datetime.now().date() + timedelta(days=5)],
style={"width": 330},
),
dmc.Space(h=10),
dmc.Text(id="selected-date-date-range-picker"),
]
)
@callback(
Output("selected-date-date-range-picker", "children"),
Input("date-range-picker", "value"),
)
def update_output(dates):
prefix = "You have selected: "
if dates:
return prefix + " - ".join(dates)
else:
raise PreventUpdate
So how can I filter data with Dash Mantine when I don’t have start_date and end_date?
Thank and best regard