Skip to content
Snippets Groups Projects
Commit eba42795 authored by Florian Obersteiner's avatar Florian Obersteiner :octopus:
Browse files

auto-disable checkbox if no data

parent cb27d6d9
No related branches found
No related tags found
1 merge request!11draft auto-deployment
......@@ -3,8 +3,7 @@ import logging as log
import pandas as pd
import plotly.graph_objects as go
import xarray as xr
from dash import Dash
from dash.dependencies import Input, Output
from dash import Dash, Input, Output, State
from plotly.subplots import make_subplots
......@@ -237,3 +236,24 @@ def register_timeseries_plot(app: Dash, timeseries_data: pd.DataFrame, var_info:
fig_ts.update_yaxes(title=f"{secondary_variable} {unit_secondary}", secondary_y=True)
return [fig_ts]
def register_trajdatamissing_response(app: Dash):
"""
Register callback to Disable the "show trajectories" checkbox if there is no
trajectory data.
"""
@app.callback(
Output("trajectories-checkbox", "value"),
Input(
"confirm-trajdata-warning", "submit_n_clicks"
), # need at least on input field for the callback to work
State("trajectories-checkbox", "value"),
)
def handle_confirmation_response(submit_clicks, current_values):
if current_values is None:
return []
if current_values[0] == 1:
return []
return current_values
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment