widgets
main.widgets
¤
Widgets to be used to interact with the plots.
Functions:¤
add_bar_callback_to_button(button, dates, plot, chart_months)
¤
Add the JS callback to a button to update a plot x_range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
button
|
Button
|
The button to add the callback to |
required |
dates
|
tuple[datetime, datetime]
|
Tuple of datetimes used to update the plot x_range |
required |
plot
|
figure
|
The plot the button will be used to update |
required |
chart_months
|
list[str]
|
list of months for x-axis in bar chart |
required |
Source code in main/widgets.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
add_callback_to_button(button, dates, plot, include_future_dates=True)
¤
Add the JS callback to a button to update a plot x_range.
If future dates are not included (e.g. for cost recovery plots), the end date of the x_range is the last day of the previous month.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
button
|
Button
|
The button to add the callback to |
required |
dates
|
tuple[datetime, datetime]
|
Tuple of datetimes used to update the plot x_range |
required |
plot
|
figure
|
The plot the button will be used to update |
required |
include_future_dates
|
bool
|
Whether to include future dates in the timeseries plot |
True
|
Source code in main/widgets.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |