Python dash_html_components.Label() Examples

The following are 25 code examples of dash_html_components.Label(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module dash_html_components , or try the search function .
Example #1
Source File: _well_cross_section_fmu.py    From webviz-subsurface with GNU General Public License v3.0 7 votes vote down vote up
def surface_names_layout(self):
        return html.Div(
            style=self.set_style(marginTop="20px"),
            children=html.Label(
                children=[
                    html.Span("Surface:", style={"font-weight": "bold"}),
                    dcc.Dropdown(
                        id=self.ids("surfacenames"),
                        options=[
                            {"label": name, "value": name} for name in self.surfacenames
                        ],
                        value=self.surfacenames,
                        clearable=True,
                        multi=True,
                    ),
                ]
            ),
        ) 
Example #2
Source File: qb_stats.py    From qb with MIT License 7 votes vote down vote up
def compute_stats(questions: List[Question], db_path):
    n_total = len(questions)
    n_guesser_train = sum(1 for q in questions if q.fold == 'guesstrain')
    n_guesser_dev = sum(1 for q in questions if q.fold == 'guessdev')
    n_buzzer_train = sum(1 for q in questions if q.fold == 'buzzertrain')
    n_buzzer_dev = sum(1 for q in questions if q.fold == 'buzzerdev')
    n_dev = sum(1 for q in questions if q.fold == 'dev')
    n_test = sum(1 for q in questions if q.fold == 'test')
    columns = ['N Total', 'N Guesser Train', 'N Guesser Dev', 'N Buzzer Train', 'N Buzzer Dev', 'N Dev', 'N Test']
    data = np.array([n_total, n_guesser_train, n_guesser_dev, n_buzzer_train, n_buzzer_dev, n_dev, n_test])
    norm_data = 100 * data / n_total

    return html.Div([
        html.Label('Database Path'), html.Div(db_path),
        html.H2('Fold Distribution'),
        html.Table(
            [
                html.Tr([html.Th(c) for c in columns]),
                html.Tr([html.Td(c) for c in data]),
                html.Tr([html.Td(f'{c:.2f}%') for c in norm_data])
            ]
        )
    ]) 
Example #3
Source File: components.py    From webmc3 with Apache License 2.0 6 votes vote down vote up
def selector(title, trace, varname, include_transformed_chooser=True):
    children = [
        html.Label("Variable"),
        dcc.Dropdown(
            id='{}-selector'.format(title),
            options=get_varname_options(trace),
            value=varname
        )
    ]

    if include_transformed_chooser: 
        children.append(
            dcc.Checklist(
                id='{}-selector-include-transformed'.format(title),
                options=[{
                    'label': "Include transformed variables",
                    'value': 'include_transformed'
                }],
                values=[]
            )
        )

    return html.Div(children, style={'width': '20%'}) 
Example #4
Source File: surface_selector.py    From webviz-subsurface with GNU General Public License v3.0 6 votes vote down vote up
def attribute_selector(self):
        return html.Div(
            style={"display": "grid"},
            children=[
                html.Label("Surface attribute"),
                html.Div(
                    style=self.set_grid_layout("6fr 1fr"),
                    children=[
                        dcc.Dropdown(
                            id=self.attr_id,
                            options=[
                                {"label": attr, "value": attr} for attr in self.attrs
                            ],
                            value=self.attrs[0],
                            clearable=False,
                        ),
                        self._make_buttons(
                            self.attr_id_btn_prev, self.attr_id_btn_next
                        ),
                    ],
                ),
            ],
        ) 
Example #5
Source File: _well_cross_section_fmu.py    From webviz-subsurface with GNU General Public License v3.0 6 votes vote down vote up
def well_layout(self):
        return html.Div(
            children=html.Label(
                children=[
                    html.Span("Well:", style={"font-weight": "bold"}),
                    dcc.Dropdown(
                        id=self.ids("wells"),
                        options=[
                            {"label": Path(well).stem, "value": well}
                            for well in self.wellfiles
                        ],
                        value=self.wellfiles[0],
                        clearable=False,
                    ),
                ]
            )
        ) 
Example #6
Source File: _well_cross_section_fmu.py    From webviz-subsurface with GNU General Public License v3.0 6 votes vote down vote up
def ensemble_layout(self):
        return html.Div(
            style=self.set_style(marginTop="20px"),
            children=html.Label(
                children=[
                    html.Span("Ensemble:", style={"font-weight": "bold"}),
                    dcc.Dropdown(
                        id=self.ids("ensembles"),
                        options=[
                            {"label": ens, "value": ens}
                            for ens in self.ensembles.keys()
                        ],
                        value=list(self.ensembles.keys())[0],
                        clearable=False,
                        multi=False,
                    ),
                ]
            ),
        ) 
Example #7
Source File: _well_cross_section_fmu.py    From webviz-subsurface with GNU General Public License v3.0 6 votes vote down vote up
def marginal_log_layout(self):
        if self.marginal_logs is not None:
            return html.Div(
                children=html.Label(
                    children=[
                        html.Span("Marginal log:", style={"font-weight": "bold"}),
                        dcc.Dropdown(
                            id=self.ids("marginal-log"),
                            options=[
                                {"label": log, "value": log}
                                for log in self.marginal_logs
                            ],
                            placeholder="Display log",
                            clearable=True,
                        ),
                    ]
                ),
            )
        return html.Div(
            style={"visibility": "hidden"},
            children=dcc.Dropdown(id=self.ids("marginal-log")),
        ) 
Example #8
Source File: _inplace_volumes_onebyone.py    From webviz-subsurface with GNU General Public License v3.0 6 votes vote down vote up
def selector(self, label, id_name, column):
        return html.Div(
            children=html.Label(
                children=[
                    html.Span(f"{label}:", style={"font-weight": "bold"}),
                    dcc.Dropdown(
                        id=self.uuid(id_name),
                        options=[
                            {"label": i, "value": i}
                            for i in list(self.volumes[column].unique())
                        ],
                        clearable=False,
                        value=list(self.volumes[column])[0],
                    ),
                ]
            ),
        ) 
Example #9
Source File: _inplace_volumes_onebyone.py    From webviz-subsurface with GNU General Public License v3.0 6 votes vote down vote up
def response_selector(self):
        """Dropdown to select volumetric response"""
        return html.Div(
            children=html.Label(
                children=[
                    html.Span("Volumetric calculation:", style={"font-weight": "bold"}),
                    dcc.Dropdown(
                        id=self.uuid("response"),
                        options=[
                            {"label": volume_description(i), "value": i}
                            for i in self.responses
                        ],
                        clearable=False,
                        value=self.initial_response
                        if self.initial_response in self.responses
                        else self.responses[0],
                    ),
                ]
            ),
        ) 
Example #10
Source File: _well_cross_section.py    From webviz-subsurface with GNU General Public License v3.0 6 votes vote down vote up
def well_layout(self):
        return html.Div(
            children=html.Label(
                children=[
                    html.Span("Well:", style={"font-weight": "bold"}),
                    dcc.Dropdown(
                        id=self.ids("wells"),
                        options=[
                            {"label": Path(well).stem, "value": well}
                            for well in self.wellfiles
                        ],
                        value=self.wellfiles[0],
                        clearable=False,
                    ),
                ]
            ),
        ) 
Example #11
Source File: _reservoir_simulation_timeseries_onebyone.py    From webviz-subsurface with GNU General Public License v3.0 6 votes vote down vote up
def ensemble_selector(self):
        """Dropdown to select ensemble"""
        return html.Div(
            style={"paddingBottom": "30px"},
            children=html.Label(
                children=[
                    html.Span("Ensemble:", style={"font-weight": "bold"}),
                    dcc.Dropdown(
                        id=self.ids("ensemble"),
                        options=[
                            {"label": i, "value": i}
                            for i in list(self.data["ENSEMBLE"].unique())
                        ],
                        clearable=False,
                        value=list(self.data["ENSEMBLE"].unique())[0],
                    ),
                ]
            ),
        ) 
Example #12
Source File: _reservoir_simulation_timeseries_onebyone.py    From webviz-subsurface with GNU General Public License v3.0 6 votes vote down vote up
def smry_selector(self):
        """Dropdown to select ensemble"""
        return html.Div(
            style={"paddingBottom": "30px"},
            children=html.Label(
                children=[
                    html.Span("Time series:", style={"font-weight": "bold"}),
                    dcc.Dropdown(
                        id=self.ids("vector"),
                        options=[
                            {
                                "label": f"{simulation_vector_description(vec)} ({vec})",
                                "value": vec,
                            }
                            for vec in self.smry_cols
                        ],
                        clearable=False,
                        value=self.initial_vector,
                    ),
                ]
            ),
        ) 
Example #13
Source File: _parameter_correlation.py    From webviz-subsurface with GNU General Public License v3.0 5 votes vote down vote up
def layout(self):
        return wcc.FlexBox(
            children=[
                html.Div(
                    style={"flex": 1},
                    children=[
                        self.matrix_plot,
                        html.Div(
                            style={"padding": "5px"},
                            children=[
                                html.Label(
                                    "Set ensemble in all plots:",
                                    style={"font-weight": "bold"},
                                ),
                                Widgets.dropdown_from_dict(
                                    self.ids("ensemble-all"), self.ensembles
                                ),
                            ],
                        ),
                    ],
                ),
                html.Div(
                    style={"flex": 1},
                    children=[
                        html.Div(
                            style={"height": "400px"},
                            children=[wcc.Graph(id=self.ids("scatter"))],
                        )
                    ]
                    + self.control_div,
                ),
            ]
        ) 
Example #14
Source File: rft_plotter.py    From webviz-subsurface with GNU General Public License v3.0 5 votes vote down vote up
def size_color_layout(self):
        return [
            html.Div(
                children=[
                    html.Label(style={"font-weight": "bold"}, children="Color by",),
                    dcc.Dropdown(
                        id=self.uuid("crossplot_color"),
                        options=[
                            {"label": "Misfit", "value": "ABSDIFF",},
                            {"label": "Standard Deviation", "value": "STDDEV",},
                        ],
                        value="STDDEV",
                        clearable=False,
                    ),
                ],
            ),
            html.Div(
                children=[
                    html.Label(style={"font-weight": "bold"}, children="Size by",),
                    dcc.Dropdown(
                        id=self.uuid("crossplot_size"),
                        options=[
                            {"label": "Standard Deviation", "value": "STDDEV",},
                            {"label": "Misfit", "value": "ABSDIFF",},
                        ],
                        value="ABSDIFF",
                        clearable=False,
                    ),
                ],
            ),
        ] 
Example #15
Source File: rft_plotter.py    From webviz-subsurface with GNU General Public License v3.0 5 votes vote down vote up
def filter_layout(self, tab):
        """Layout for shared filters"""
        return [
            html.Label(style={"font-weight": "bold"}, children=["Ensembles"],),
            wcc.Select(
                size=min(4, len(self.ensembles)),
                id=self.uuid(f"ensemble-{tab}"),
                options=[{"label": name, "value": name} for name in self.ensembles],
                value=self.ensembles,
                multi=True,
            ),
            html.Label(style={"font-weight": "bold"}, children=["Wells"],),
            wcc.Select(
                size=min(20, len(self.well_names)),
                id=self.uuid(f"well-{tab}"),
                options=[{"label": name, "value": name} for name in self.well_names],
                value=self.well_names,
                multi=True,
            ),
            html.Label(style={"font-weight": "bold"}, children=["Zones"],),
            wcc.Select(
                size=min(10, len(self.zone_names)),
                id=self.uuid(f"zone-{tab}"),
                options=[{"label": name, "value": name} for name in self.zone_names],
                value=self.zone_names,
                multi=True,
            ),
            html.Label(style={"font-weight": "bold"}, children=["Dates"],),
            wcc.Select(
                size=min(10, len(self.dates)),
                id=self.uuid(f"date-{tab}"),
                options=[{"label": name, "value": name} for name in self.dates],
                value=self.dates,
                multi=True,
            ),
        ] 
Example #16
Source File: _well_cross_section.py    From webviz-subsurface with GNU General Public License v3.0 5 votes vote down vote up
def well_options(self):
        return html.Div(
            style={"marginLeft": "20px", "marginRight": "0px", "marginBotton": "0px"},
            children=[
                html.Div(
                    children=html.Label(
                        children=[
                            html.Span("Sampling:", style={"font-weight": "bold"}),
                            dcc.Input(
                                id=self.ids("sampling"),
                                debounce=True,
                                type="number",
                                value=self.sampling,
                            ),
                        ]
                    )
                ),
                html.Div(
                    children=html.Label(
                        children=[
                            html.Span("Nextend:", style={"font-weight": "bold"}),
                            dcc.Input(
                                id=self.ids("nextend"),
                                debounce=True,
                                type="number",
                                value=self.nextend,
                            ),
                        ]
                    )
                ),
            ],
        ) 
Example #17
Source File: _morris_plot.py    From webviz-subsurface with GNU General Public License v3.0 5 votes vote down vote up
def layout(self):
        return html.Div(
            [
                html.Label("Vector", style={"font-size": "2rem"}),
                dcc.Dropdown(
                    id=self.vector_id,
                    clearable=False,
                    options=[{"label": i, "value": i} for i in list(self.vector_names)],
                    value=self.vector_names[0],
                ),
                Morris(id=self.graph_id),
            ]
        ) 
Example #18
Source File: _parameter_response_correlation.py    From webviz-subsurface with GNU General Public License v3.0 5 votes vote down vote up
def control_layout(self):
        """Layout to select e.g. iteration and response"""
        return [
            html.Div(
                [
                    html.Label("Ensemble"),
                    dcc.Dropdown(
                        id=self.ids("ensemble"),
                        options=[
                            {"label": ens, "value": ens} for ens in self.ensembles
                        ],
                        clearable=False,
                        value=self.ensembles[0],
                    ),
                ]
            ),
            html.Div(
                [
                    html.Label("Response"),
                    dcc.Dropdown(
                        id=self.ids("responses"),
                        options=[
                            {"label": ens, "value": ens} for ens in self.responses
                        ],
                        clearable=False,
                        value=self.responses[0],
                    ),
                ]
            ),
        ] 
Example #19
Source File: _well_cross_section_fmu.py    From webviz-subsurface with GNU General Public License v3.0 5 votes vote down vote up
def intersection_option(self):
        options = [
            {"label": "Keep zoom state", "value": "keep_zoom_state"},
            {"label": "Show surface fill", "value": "show_surface_fill"},
        ]
        value = ["show_surface_fill"]
        if self.segyfiles:
            options.append({"label": "Show seismic", "value": "show_seismic"})
        if self.zonelog is not None:
            options.append({"label": "Show zonelog", "value": "show_zonelog"})
            value.append("show_zonelog")

        return html.Div(
            style=self.set_style(marginTop="20px"),
            children=[
                html.Label("Intersection settings", style={"font-weight": "bold"}),
                html.Label("Sampling"),
                dcc.Input(
                    id=self.ids("sampling"),
                    debounce=True,
                    type="number",
                    value=self.sampling,
                ),
                html.Label("Extension"),
                dcc.Input(
                    id=self.ids("nextend"),
                    debounce=True,
                    type="number",
                    value=self.nextend,
                ),
                dcc.Checklist(id=self.ids("options"), options=options, value=value),
            ],
        ) 
Example #20
Source File: surface_selector.py    From webviz-subsurface with GNU General Public License v3.0 5 votes vote down vote up
def selector(self, wrapper_id, dropdown_id, title, btn_prev, btn_next):
        return html.Div(
            id=wrapper_id,
            style={"display": "none"},
            children=[
                html.Label(title),
                html.Div(
                    style=self.set_grid_layout("6fr 1fr"),
                    children=[
                        dcc.Dropdown(id=dropdown_id, clearable=False),
                        self._make_buttons(btn_prev, btn_next),
                    ],
                ),
            ],
        ) 
Example #21
Source File: dynamic-autocomplete-dropdown.py    From dash-recipes with MIT License 5 votes vote down vote up
def generate_layout(url):
    return html.Div([
        html.Label('Multi-Select Dropdown'),
        dcc.Dropdown(
            options=[
                {'label': 'New York City', 'value': 'NYC'},
                {'label': u'Montréal', 'value': 'MTL'},
                {'label': 'San Francisco', 'value': 'SF'}
            ],
            value=['MTL', 'SF'],
            multi=True,
            id='input'
        ),
        html.Div(id='output')
    ]) 
Example #22
Source File: qb_stats.py    From qb with MIT License 5 votes vote down vote up
def display_question(question: Question):
    return html.Div([
        html.Label('ID'), html.Span(question.qnum)
    ]) 
Example #23
Source File: plot.py    From graphql-bench with Apache License 2.0 4 votes vote down vote up
def run_dash_server(bench_results):

    with open("/graphql-bench/ws/bench_results.json","w+") as resultFile:
        json.dump(bench_results,resultFile)

    app = dash.Dash()

    app.layout = html.Div(children=[

        html.Label('Benchmark'),
        dcc.Dropdown(
            id='benchmark-index',
            options=[{'label':r['benchmark'], 'value': i} for i, r in enumerate(bench_results)],
            value='0'
        ),

        html.Label('Response time metric'),
        dcc.Dropdown(
            id='response-time-metric',
            options=[
                {'label': 'P95', 'value': 'P95'},
                {'label': 'P98', 'value': 'P98'},
                {'label': 'P99', 'value': 'P99'},
                {'label': 'Min', 'value': 'MIN'},
                {'label': 'Max', 'value': 'MAX'},
                {'label': 'Average', 'value': 'AVG'}
            ],
            value='P95'
        ),

        dcc.Graph(id='response-time-vs-rps')
    ])

    @app.callback(
        Output('response-time-vs-rps', 'figure'),
        [
            Input('benchmark-index', 'value'),
            Input('response-time-metric', 'value')
        ]
    )
    def updateGraph(benchMarkIndex, yMetric):
        benchMarkIndex=int(benchMarkIndex)
        figure={
            'data': get_data(bench_results[benchMarkIndex]['results'],get_ymetric_fn(yMetric)),
            'layout': {
                'yaxis' : {
                    'title': "Response time ({}) in ms".format(yMetric)
                },
                'xaxis' : {
                    'title': "Requests/sec"
                },
                'title' : 'Response time vs Requests/sec for {}'.format(bench_results[benchMarkIndex]['benchmark'])
            }
        }
        return figure

    app.run_server(host="0.0.0.0", debug=False) 
Example #24
Source File: _parameter_correlation.py    From webviz-subsurface with GNU General Public License v3.0 4 votes vote down vote up
def control_div(self):
        return [
            html.Div(
                style={"padding": "5px"},
                children=[
                    html.Label(
                        "Parameter horizontal axis:", style={"font-weight": "bold"},
                    ),
                    dcc.Dropdown(
                        id=self.ids("parameter1"),
                        options=[{"label": p, "value": p} for p in self.p_cols],
                        value=self.p_cols[0],
                        clearable=False,
                    ),
                    Widgets.dropdown_from_dict(self.ids("ensemble-1"), self.ensembles),
                ],
            ),
            html.Div(
                style={"padding": "5px"},
                children=[
                    html.Label(
                        "Parameter vertical axis:", style={"font-weight": "bold"}
                    ),
                    dcc.Dropdown(
                        id=self.ids("parameter2"),
                        options=[{"label": p, "value": p} for p in self.p_cols],
                        value=self.p_cols[0],
                        clearable=False,
                    ),
                    Widgets.dropdown_from_dict(self.ids("ensemble-2"), self.ensembles),
                ],
            ),
            html.Div(
                style={"padding": "5px"},
                children=[
                    html.Label("Color scatter by:", style={"font-weight": "bold"}),
                    dcc.Dropdown(
                        id=self.ids("scatter-color"),
                        options=[{"label": p, "value": p} for p in self.p_cols],
                    ),
                ],
            ),
            dcc.Checklist(
                id=self.ids("density"),
                style={"padding": "5px"},
                options=[{"label": "Show scatterplot density", "value": "density",}],
            ),
        ] 
Example #25
Source File: _inplace_volumes.py    From webviz-subsurface with GNU General Public License v3.0 4 votes vote down vote up
def plot_options_layout(self):
        """Row layout of dropdowns for plot options"""
        return wcc.FlexBox(
            children=[
                html.Div(
                    children=html.Label(
                        children=[
                            html.Span("Response:", style={"font-weight": "bold"}),
                            dcc.Dropdown(
                                id=self.ids("response"),
                                options=[
                                    {"label": volume_description(i), "value": i}
                                    for i in self.responses
                                ],
                                value=self.initial_response
                                if self.initial_response in self.responses
                                else self.responses[0],
                                clearable=False,
                            ),
                        ]
                    )
                ),
                html.Div(
                    children=html.Label(
                        children=[
                            html.Span("Plot type:", style={"font-weight": "bold"}),
                            dcc.Dropdown(
                                id=self.ids("plot-type"),
                                options=[
                                    {"label": i, "value": i} for i in self.plot_types
                                ],
                                value=self.initial_plot,
                                clearable=False,
                            ),
                        ]
                    )
                ),
                html.Div(
                    children=html.Label(
                        children=[
                            html.Span("Group by:", style={"font-weight": "bold"}),
                            dcc.Dropdown(
                                id=self.ids("group"),
                                options=[
                                    {"label": i.lower().capitalize(), "value": i}
                                    for i in self.selectors
                                ],
                                value=self.initial_group,
                                placeholder="Not grouped",
                            ),
                        ]
                    )
                ),
            ],
        )