Skip to content

Commit

Permalink
Improve selectors in TablePlotter (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Kallekleiv authored Jun 4, 2020
1 parent 01585e0 commit d109678
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 66 deletions.
29 changes: 17 additions & 12 deletions webviz_config/plugins/_table_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class TablePlotter(WebvizPluginABC):
* `csv_file`: Path to the csv file containing the tabular data. Either absolute
path or relative to the configuration file.
* `plot_options`: A dictionary of plot options to initialize the plot with
* `filter_cols`: Dataframe columns that can be used to filter data
* `lock`: If `True`, only the plot is shown, all dropdowns for changing
plot options are hidden.
"""
Expand Down Expand Up @@ -72,15 +73,7 @@ def plots(self) -> dict:
"""A list of available plots and their options"""
return {
"scatter": ["x", "y", "size", "color", "facet_col"],
"histogram": [
"x",
"y",
"color",
"facet_col",
"barmode",
"barnorm",
"histnorm",
],
"histogram": ["x", "color", "facet_col", "barmode", "barnorm", "histnorm",],
"bar": ["x", "y", "color", "facet_col"],
"scatter_3d": ["x", "y", "z", "size", "color"],
"line": ["x", "y", "color", "line_group", "facet_col"],
Expand All @@ -102,46 +95,55 @@ def plot_args(self) -> dict:
"options": self.columns,
"value": self.plot_options.get("x", self.columns[0]),
"multi": False,
"clearable": False,
},
"y": {
"options": self.columns,
"value": self.plot_options.get("y", self.columns[0]),
"multi": False,
"clearable": False,
},
"z": {
"options": self.columns,
"value": self.plot_options.get("z", self.columns[0]),
"multi": False,
"clearable": False,
},
"size": {
"options": self.numeric_columns,
"value": self.plot_options.get("size", None),
"multi": False,
"clearable": True,
},
"color": {
"options": self.columns,
"value": self.plot_options.get("color", None),
"multi": False,
"clearable": True,
},
"facet_col": {
"options": self.columns,
"value": self.plot_options.get("facet_col", None),
"multi": False,
"clearable": True,
},
"line_group": {
"options": self.columns,
"value": self.plot_options.get("line_group", None),
"multi": False,
"clearable": True,
},
"barmode": {
"options": ["stack", "group", "overlay", "relative"],
"value": self.plot_options.get("barmode", "stack"),
"multi": False,
"clearable": True,
},
"barnorm": {
"options": ["fraction", "percent"],
"value": self.plot_options.get("barnorm", None),
"multi": False,
"clearable": True,
},
"histnorm": {
"options": [
Expand All @@ -152,16 +154,19 @@ def plot_args(self) -> dict:
],
"value": self.plot_options.get("histnorm", None),
"multi": False,
"clearable": True,
},
"trendline": {
"options": self.numeric_columns,
"value": None,
"multi": False,
"clearable": True,
},
"dimensions": {
"options": self.columns,
"value": self.plot_options.get("dimensions", self.columns),
"multi": True,
"clearable": True,
},
}
)
Expand Down Expand Up @@ -210,13 +215,13 @@ def filter_layout(self) -> Optional[list]:
open=True,
children=[
html.Summary(col.lower().capitalize()),
dcc.Dropdown(
wcc.Select(
id=self.uuid(f"filter-{col}"),
options=[
{"label": i, "value": i} for i in elements
],
value=elements,
multi=True,
size=min(15, len(elements)),
),
],
)
Expand Down Expand Up @@ -255,7 +260,7 @@ def plot_option_layout(self) -> List[html.Div]:
html.P(key),
dcc.Dropdown(
id=self.uuid(f"dropdown-{key}"),
clearable=False,
clearable=arg["clearable"],
options=[{"label": i, "value": i} for i in arg["options"]],
value=arg["value"],
multi=arg["multi"],
Expand Down
54 changes: 0 additions & 54 deletions webviz_config/themes/default_assets/default_theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -363,60 +363,6 @@ a:active {
border-color: var(--menuLinkBackgroundHover);
}

/* Forms
–––––––––––––––––––––––––––––––––––––––––––––––––– */
input[type=email], input[type=number], input[type=search], input[type=text], input[type=tel], input[type=url], input[type=password], textarea, select {
height: 38px;
padding: 6px 10px;
/* The 6px vertically centers text on FF, ignored by Webkit */
background-color: #fff;
border: 1px solid #D1D1D1;
border-radius: 4px;
box-shadow: none;
box-sizing: border-box;
font-family: inherit;
font-size: inherit;
/*https://stackoverflow.com/questions/6080413/why-doesnt-input-inherit-the-font-from-body*/
}

/* Removes awkward default styles on some inputs for iOS */
input[type=email], input[type=number], input[type=search], input[type=text], input[type=tel], input[type=url], input[type=password], textarea {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}

textarea {
min-height: 65px;
padding-top: 6px;
padding-bottom: 6px;
}

input[type=email]:focus, input[type=number]:focus, input[type=search]:focus, input[type=text]:focus, input[type=tel]:focus, input[type=url]:focus, input[type=password]:focus, textarea:focus, select:focus {
border: 1px solid var(--menuLinkBackgroundHover);
outline: 0;
}

label, legend {
display: block;
margin-bottom: 0px;
}

fieldset {
padding: 0;
border-width: 0;
}

input[type=checkbox], input[type=radio] {
display: inline;
}

label > .label-body {
display: inline-block;
margin-left: 0.5rem;
font-weight: normal;
}

/* Lists
–––––––––––––––––––––––––––––––––––––––––––––––––– */
ul {
Expand Down

0 comments on commit d109678

Please sign in to comment.