def histogram_options(uuid: str, tab: str) -> html.Div: return html.Div(children=[ wcc.RadioItems( label="Barmode:", id={ "id": uuid, "tab": tab, "selector": "barmode" }, options=[ { "label": "overlay", "value": "overlay" }, { "label": "group", "value": "group" }, { "label": "stack", "value": "stack" }, ], labelStyle={ "display": "inline-flex", "margin-right": "5px" }, value="overlay", ), wcc.Slider( label="Histogram bins:", id={ "id": uuid, "tab": tab, "selector": "hist_bins" }, value=15, min=1, max=30, ), ])
def date_selector( get_uuid: Callable, vectormodel: SimulationTimeSeriesModel ) -> html.Div: dates = vectormodel.dates return html.Div( style={"margin": "10px 0px"}, children=[ html.Div( style={"display": "inline-flex"}, children=[ wcc.Label("Date:"), wcc.Label( to_str(dates[-1]), id=get_uuid("date-selected-text"), style={"margin-left": "10px"}, ), dcc.Store( id=get_uuid("date-selected"), storage_type="session", data=to_str(dates[-1]), ), ], ), wcc.Slider( id=get_uuid("date-slider"), value=len(dates) - 1, min=0, max=len(dates) - 1, step=1, included=False, marks={ idx: { "label": to_str(dates[idx]), "style": {"white-space": "nowrap"}, } for idx in [0, len(dates) - 1] }, ), ], )
def control_layout(self): """Layout to select e.g. iteration and response""" max_params = len(self.parameter_columns) return [ wcc.Dropdown( label="Ensemble", id=self.uuid("ensemble"), options=[{ "label": ens, "value": ens } for ens in self.ensembles], clearable=False, value=self.ensembles[0], ), wcc.Dropdown( label="Response", id=self.uuid("responses"), options=[{ "label": ens, "value": ens } for ens in self.response_columns], clearable=False, value=self.response_columns[0], ), html.Div( wcc.Slider( label="Max number of parameters", id=self.uuid("max-params"), min=1, max=max_params, marks={ "1": 1, str(max_params): max_params }, value=max_params, ), style={"margin-top": "10px"}, ), ]
def date_selector(get_uuid: Callable, vectormodel: SimulationTimeSeriesModel) -> html.Div: dates = vectormodel.dates return html.Div( style={"margin": "10px 0px"}, children=[ html.Div( style={"display": "inline-flex"}, children=[ html.Span(wcc.Label("Date:")), html.Span( html.Label( "date", id=get_uuid("date-selected"), style={"margin-left": "10px"}, ), ), ], ), wcc.Slider( id=get_uuid("date-slider"), value=len(dates) - 1, min=0, max=len(dates) - 1, included=False, marks={ idx: { "label": dates[idx], "style": { "white-space": "nowrap", }, } for idx in [0, len(dates) - 1] }, ), ], )
def layout(self) -> wcc.FlexBox: return wcc.FlexBox( id=self.uuid("layout"), children=[ wcc.Frame( style={ "flex": 1, "height": "45vh" }, children=[ wcc.Dropdown( label="Ensemble", id=self.uuid("ensemble"), options=[{ "label": i, "value": i } for i in self.ensembles], value=self.ensembles[0], clearable=False, multi=False, ), wcc.Dropdown( label="Plot type", id=self.uuid("plot_type"), options=[{ "label": i, "value": i } for i in [ "Fan chart", "Bar chart", "Line chart", ]], clearable=False, value="Fan chart", ), html.Div( id=self.uuid("select_stat"), style={"display": "none"}, children=[ wcc.SelectWithLabel( label="Select statistics", id=self.uuid("stat_bars"), options=[{ "label": key, "value": value } for key, value in self.label_map.items() ], size=8, value=["count", "low_p90", "p50"], ), ], ), wcc.Dropdown( label="Sort by", id=self.uuid("sort_by"), options=[{ "label": key, "value": value } for key, value in self.label_map.items()], clearable=False, value="low_p90", ), wcc.RadioItems( vertical=False, id=self.uuid("ascending"), options=[ { "label": "Ascending", "value": True }, { "label": "Descending", "value": False }, ], value=True, labelStyle={"display": "inline-block"}, ), wcc.Slider( label="Max number of wells in plot", id=self.uuid("n_wells"), min=1, max=len(self.wells), step=1, value=min(10, len(self.wells)), marks={ 1: 1, len(self.wells): len(self.wells) }, ), wcc.SelectWithLabel( label="Wells", id=self.uuid("wells"), options=[{ "label": i, "value": i } for i in self.wells], size=min([len(self.wells), 20]), value=self.wells, ), ], ), wcc.Frame( color="white", highlight=False, style={ "flex": 6, "height": "45vh" }, children=[ wcc.Graph(id=self.uuid("graph")), ], ), ], )
def control_layout(self) -> List[Any]: """Layout to select e.g. iteration and response""" max_params = len(self.parameter_columns) return [ wcc.Dropdown( label="Ensemble:", id=self.uuid("ensemble"), options=[{ "label": ens, "value": ens } for ens in self.ensembles], clearable=False, value=self.ensembles[0], ), wcc.Dropdown( label="Response:", id=self.uuid("responses"), options=[{ "label": col, "value": col } for col in self.response_columns], clearable=False, value=self.response_columns[0], ), wcc.RadioItems( label="Correlation method:", id=self.uuid("correlation-method"), options=[{ "label": opt.capitalize(), "value": opt } for opt in ["pearson", "spearman"]], vertical=False, value=self.corr_method, ), wcc.RadioItems( label="Response aggregation:", id=self.uuid("aggregation"), options=[{ "label": opt.capitalize(), "value": opt } for opt in ["sum", "mean"]], vertical=False, value=self.aggregation, ), html.Div( wcc.Slider( label="Correlation cut-off (abs):", id=self.uuid("correlation-cutoff"), min=0, max=1, step=0.1, marks={ "0": 0, "1": 1 }, value=0, ), style={"margin-top": "10px"}, ), html.Div( wcc.Slider( label="Max number of parameters:", id=self.uuid("max-params"), min=1, max=max_params, step=1, marks={ 1: "1", max_params: str(max_params) }, value=max_params, ), style={"marginTop": "10px"}, ), ]