Esempio n. 1
0
 def settings_layout(self) -> wcc.FlexBox:
     """Layout for color and other settings"""
     return wcc.Frame(
         style={"width": "40%"},
         children=[
             html.Div(
                 style={"width": "100%"},
                 children=wcc.Dropdown(
                     label="Seismic cube",
                     id=self.uuid("cube"),
                     options=[{
                         "label": Path(cube).stem,
                         "value": cube
                     } for cube in self.segyfiles],
                     value=self.segyfiles[0],
                     clearable=False,
                 ),
             ),
             html.Div(children=[
                 wcc.Label(children="Set colorscale", ),
                 wcc.ColorScales(
                     id=self.uuid("color-scale"),
                     colorscale=self.initial_colors,
                     nSwatches=12,
                 ),
             ], ),
             html.Div(children=[
                 wcc.RangeSlider(
                     label="Color range",
                     id=self.uuid("color-values"),
                     min=self.init_state["min_value"],
                     max=self.init_state["max_value"],
                     value=[
                         self.init_state["min_value"],
                         self.init_state["max_value"],
                     ],
                     tooltip={"placement": "bottom"},
                     step=calculate_slider_step(
                         min_value=self.init_state["min_value"],
                         max_value=self.init_state["max_value"],
                         steps=100,
                     ),
                 ),
             ], ),
             html.Button(id=self.uuid("color-reset"),
                         children="Reset Range"),
             html.Button(id=self.uuid("zoom"), children="Reset zoom"),
         ],
     )
def test_colorscale(dash_duo):

    app = dash.Dash(__name__)

    app.layout = html.Div(
        [
            webviz_core_components.ColorScales(
                id="colorscale",
                colorscale=["red", "blue"],
                nSwatches=12,
                fixSwatches=False,
            ),
        ]
    )

    dash_duo.start_server(app)

    assert dash_duo.get_logs() == [], "browser console should contain no error"
Esempio n. 3
0
def settings_layout(
    volumemodel: InplaceVolumesModel, uuid: str, theme: WebvizConfigTheme, tab: str
) -> wcc.Selectors:

    theme_colors = theme.plotly_theme.get("layout", {}).get("colorway", [])
    return wcc.Selectors(
        label="⚙️ SETTINGS",
        open_details=False,
        children=[
            remove_fluid_annotation(volumemodel, uuid=uuid, tab=tab),
            subplot_xaxis_range(uuid=uuid, tab=tab),
            histogram_options(uuid=uuid, tab=tab),
            html.Span("Colors", style={"font-weight": "bold"}),
            wcc.ColorScales(
                id={"id": uuid, "tab": tab, "settings": "Colorscale"},
                colorscale=theme_colors,
                fixSwatches=True,
                nSwatches=12,
            ),
        ],
    )
 def seismic_layout(self):
     """Layout for color and other settings"""
     return html.Div(children=[
         html.Div(
             style=self.set_grid_layout("3fr 2fr"),
             children=[
                 html.Div(children=[
                     html.Label(
                         style={
                             "font-weight": "bold",
                             "textAlign": "center",
                         },
                         children="Select seismic cube",
                     ),
                     dcc.Dropdown(
                         id=self.ids("cube"),
                         options=[{
                             "label": Path(cube).stem,
                             "value": cube
                         } for cube in self.segyfiles],
                         value=self.segyfiles[0],
                         clearable=False,
                     ),
                 ]),
                 html.Div(
                     style={"zIndex": 2000},
                     children=[
                         html.Label(
                             style={
                                 "font-weight": "bold",
                                 "textAlign": "center",
                             },
                             children="Set colorscale",
                         ),
                         wcc.ColorScales(
                             id=self.ids("color-scale"),
                             colorscale=self.initial_colors,
                             nSwatches=12,
                         ),
                     ],
                 ),
                 html.Div(
                     style={
                         "marginRight": "50px",
                         "marginTop": "20px",
                         "marginLeft": "50px",
                         "marginBottom": "0px",
                     },
                     children=[
                         html.Label(
                             style={
                                 "font-weight": "bold",
                                 "textAlign": "center",
                             },
                             children="Set color range",
                         ),
                         dcc.RangeSlider(
                             id=self.ids("color-values"),
                             tooltip={"always_visible": True},
                         ),
                     ],
                 ),
                 html.Button(id=self.ids("color-range-btn"),
                             children="Reset Range"),
             ],
         ),
         html.Div(
             style={"height": "800px"},
             children=wcc.Graph(config={"displayModeBar": False},
                                id=self.ids("fence-view")),
         ),
     ])
Esempio n. 5
0
import dash
from dash.dependencies import Input, Output, State
import dash_html_components as html
import webviz_core_components

app = dash.Dash(__name__)

app.layout = html.Div([
    webviz_core_components.WebvizPluginPlaceholder(id="plugin",
                                                   children=["Hello world"]),
    webviz_core_components.WebvizPluginPlaceholder(
        id="some-other-plugin",
        children=[
            webviz_core_components.ColorScales(id="colorscale"),
            webviz_core_components.Graph(
                id="example-graph",
                figure={
                    "data": [
                        {
                            "x": [1, 2, 3],
                            "y": [4, 1, 2],
                            "type": "bar",
                            "name": "a",
                        },
                        {
                            "x": [1, 2, 3],
                            "y": [2, 4, 5],
                            "type": "bar",
                            "name": "b",
                        },
                        {
 def layout(self):
     return wcc.FlexBox(
         id=self.ids("layout"),
         children=[
             wcc.Frame(
                 style={"flex": 1},
                 children=[
                     wcc.Selectors(
                         label="Map settings",
                         children=[
                             wcc.Dropdown(
                                 id=self.ids("surface"),
                                 label="Select surface",
                                 options=[{
                                     "label": name,
                                     "value": path
                                 } for name, path in zip(
                                     self.surfacenames, self.surfacefiles)],
                                 value=self.surfacefiles[0],
                                 clearable=False,
                             ),
                             wcc.RadioItems(
                                 id=self.ids("surface-type"),
                                 options=[
                                     {
                                         "label": "Display surface z-value",
                                         "value": "surface",
                                     },
                                     {
                                         "label":
                                         "Display seismic attribute as z-value",
                                         "value": "attribute",
                                     },
                                 ],
                                 value="surface",
                             ),
                         ],
                     ),
                     wcc.Selectors(
                         label="Intersection settings",
                         children=[
                             wcc.Dropdown(
                                 label="Select seismic cube",
                                 id=self.ids("cube"),
                                 options=[{
                                     "label": Path(cube).stem,
                                     "value": cube
                                 } for cube in self.segyfiles],
                                 value=self.segyfiles[0],
                                 clearable=False,
                             ),
                             wcc.Label(children="Set colorscale", ),
                             wcc.ColorScales(
                                 id=self.ids("color-scale"),
                                 colorscale=self.initial_colors,
                                 nSwatches=12,
                             ),
                             wcc.RangeSlider(
                                 label="Set color range",
                                 id=self.ids("color-values"),
                                 tooltip={
                                     "placement": "bottom",
                                     "always_visible": True,
                                 },
                                 marks=None,
                             ),
                             html.Button(
                                 id=self.ids("color-range-btn"),
                                 children="Reset Range",
                             ),
                         ],
                     ),
                 ],
             ),
             wcc.Frame(
                 highlight=False,
                 style={
                     "height": "800px",
                     "flex": 3,
                 },
                 children=[
                     LeafletMap(
                         id=self.ids("map-view"),
                         autoScaleMap=True,
                         minZoom=-19,
                         updateMode="update",
                         layers=[],
                         drawTools={
                             "drawMarker": False,
                             "drawPolygon": False,
                             "drawPolyline": True,
                             "position": "topright",
                         },
                         mouseCoords={"position": "bottomright"},
                         colorBar={"position": "bottomleft"},
                         switch={
                             "value": False,
                             "disabled": False,
                             "label": "Hillshading",
                         },
                     ),
                 ],
             ),
             html.Div(
                 style={
                     "flex": 3,
                     "height": "800px"
                 },
                 children=[
                     wcc.Graph(config={"displayModeBar": False},
                               id=self.ids("fence-view")),
                 ],
             ),
         ],
     )
 def grid_layout(self):
     """Layout for color and other settings"""
     return html.Div(children=[
         wcc.FlexBox(children=[
             html.Div(children=[
                 html.Label(
                     style={
                         "font-weight": "bold",
                         "textAlign": "center",
                     },
                     children="Select grid parameter",
                 ),
                 dcc.Dropdown(
                     id=self.ids("gridparameter"),
                     options=[{
                         "label": name,
                         "value": para
                     } for name, para in zip(self.gridparanames,
                                             self.gridparafiles)],
                     value=self.gridparafiles[0],
                     clearable=False,
                     persistence=True,
                     persistence_type="session",
                 ),
             ]),
             html.Div(
                 style={"zIndex": 2000},
                 children=[
                     html.Label(
                         style={
                             "font-weight": "bold",
                             "textAlign": "center",
                         },
                         children="Set colorscale",
                     ),
                     wcc.ColorScales(
                         id=self.ids("color-scale"),
                         colorscale=self.initial_colors,
                         nSwatches=12,
                     ),
                 ],
             ),
         ]),
         wcc.FlexBox(children=[
             html.Div(
                 style={
                     "marginRight": "50px",
                     "marginTop": "20px",
                     "marginBottom": "0px",
                     "flex": 1,
                 },
                 children=[
                     html.Label(
                         style={
                             "font-weight": "bold",
                             "textAlign": "center",
                         },
                         children="Set color range",
                     ),
                     dcc.RangeSlider(
                         id=self.ids("color-values"),
                         tooltip={"always_visible": True},
                         persistence=True,
                         persistence_type="session",
                     ),
                 ],
             ),
             html.Div(
                 style={"flex": 1},
                 children=html.Button(id=self.ids("color-range-btn"),
                                      children="Reset Range"),
             ),
         ], ),
         html.Div(
             style={"height": "800px"},
             children=wcc.Graph(config={"displayModeBar": False},
                                id=self.ids("fence-view")),
         ),
     ])
Esempio n. 8
0
                 "background-color": "rgba(0, 255, 0, 0.2)",
             },
         ),
         html.Div(
             "Fourth",
             style={
                 "width": "40%",
                 "background-color": "rgba(0, 0, 255, 0.2)",
             },
         ),
     ])
 ]),
 wcc.WebvizPluginPlaceholder(
     id="some-other-plugin",
     children=[
         wcc.ColorScales(id="colorscale"),
         wcc.Graph(
             id="example-graph",
             figure={
                 "data": [
                     {
                         "x": [1, 2, 3],
                         "y": [4, 1, 2],
                         "type": "bar",
                         "name": "a",
                     },
                     {
                         "x": [1, 2, 3],
                         "y": [2, 4, 5],
                         "type": "bar",
                         "name": "b",
Esempio n. 9
0
 def settings_layout(self) -> wcc.FlexBox:
     """Layout for color and other settings"""
     return wcc.FlexBox(
         style={"margin": "50px"},
         children=[
             html.Div(
                 style={"width": "100%"},
                 children=html.Label(
                     children=[
                         html.Span("Seismic cube:", style={"font-weight": "bold"}),
                         dcc.Dropdown(
                             id=self.ids("cube"),
                             options=[
                                 {"label": Path(cube).stem, "value": cube}
                                 for cube in self.segyfiles
                             ],
                             value=self.segyfiles[0],
                             clearable=False,
                             persistence=True,
                             persistence_type="session",
                         ),
                     ]
                 ),
             ),
             html.Div(
                 style={"marginRight": "50px", "width": "50%", "marginLeft": "50px"},
                 children=[
                     html.Label(
                         style={"font-weight": "bold", "textAlign": "center"},
                         children="Set colorscale",
                     ),
                     wcc.ColorScales(
                         id=self.ids("color-scale"),
                         colorscale=self.initial_colors,
                         nSwatches=12,
                     ),
                 ],
             ),
             html.Div(
                 style={"marginRight": "50px", "width": "50%", "marginLeft": "50px"},
                 children=[
                     html.P(
                         "Color range",
                         style={"textAlign": "center", "font-weight": "bold"},
                     ),
                     dcc.RangeSlider(
                         id=self.ids("color-values"),
                         min=self.init_state["min_value"],
                         max=self.init_state["max_value"],
                         value=[
                             self.init_state["min_value"],
                             self.init_state["max_value"],
                         ],
                         tooltip={"always_visible": True},
                         step=calculate_slider_step(
                             min_value=self.init_state["min_value"],
                             max_value=self.init_state["max_value"],
                             steps=100,
                         ),
                         persistence=True,
                         persistence_type="session",
                     ),
                 ],
             ),
             html.Button(id=self.ids("color-reset"), children="Reset Range"),
             html.Button(id=self.ids("zoom"), children="Reset zoom"),
         ],
     )