Skip to content

Commit 7595e94

Browse files
committed
address reviewers comments
1 parent 5b151e8 commit 7595e94

File tree

3 files changed

+48
-17
lines changed

3 files changed

+48
-17
lines changed

examples/serve/panels-demo/demo_panels/panel_demo.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ def render_panel(
5050
id="info_text", children=update_info_text(ctx, dataset_id, opaque, color)
5151
)
5252

53+
instructions = Typography(
54+
id="instructions",
55+
children=[
56+
"This panel just demonstrates how server-side extensions work. "
57+
"It has no useful functionality.",
58+
],
59+
variant="body2",
60+
)
61+
5362
return Box(
5463
style={
5564
"display": "flex",
@@ -59,8 +68,7 @@ def render_panel(
5968
"gap": "6px",
6069
},
6170
children=[
62-
"This panel just demonstrates how server-side extensions work. "
63-
"It has no useful functionality.",
71+
instructions,
6472
opaque_checkbox,
6573
color_select,
6674
info_text,

examples/serve/panels-demo/demo_panels/panel_histo2d.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from xcube.core.geom import mask_dataset_by_geometry, normalize_geometry
2525
from xcube.core.gridmapping import GridMapping
2626
from xcube.server.api import Context
27+
from xcube.webapi.viewer.components import Markdown
2728
from xcube.webapi.viewer.contrib import Panel, get_dataset
2829
from xcube.webapi.viewer.contrib.helpers import get_place_label
2930

@@ -107,11 +108,21 @@ def render_panel(
107108
children=[""],
108109
)
109110

111+
instructions_text = Markdown(
112+
text="Create or select a region shape in the map, then select two "
113+
"variables from the dropdowns, and press **Update** to create "
114+
"a 2D histogram plot.",
115+
)
116+
117+
instructions = Typography(
118+
id="instructions",
119+
children=[instructions_text],
120+
variant="body2",
121+
)
122+
110123
return Box(
111124
children=[
112-
"Create or select a region shape in the map, then select two "
113-
"variables from the dropdowns, and press 'Update' to create "
114-
"a 2D histogram plot.",
125+
instructions,
115126
control_bar,
116127
plot,
117128
error_message,

examples/serve/panels-demo/demo_panels/panel_spectrum.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
RadioGroup,
2020
)
2121

22+
from xcube.webapi.viewer.components import Markdown
2223
from xcube.webapi.viewer.contrib import Panel, get_dataset
2324
from xcube.server.api import Context
2425
from xcube.constants import CRS_CRS84
@@ -61,15 +62,14 @@ def render_panel(
6162

6263
exploration_radio_group = RadioGroup(
6364
id="exploration_radio_group",
64-
children=[update_radio, add_radio],
65+
children=[add_radio, update_radio],
6566
label="Exploration Mode",
6667
style={
6768
"display": "flex",
6869
"flexDirection": "row",
6970
},
70-
tooltip="'Update': Clear the chart but the current selection if any. "
71-
"'Add': Current spectrum is added and new point selections will be "
72-
"added as new spectra",
71+
tooltip="Add: Current spectrum is added and new point selections will be "
72+
"added as new spectra. 'Update': Clear the chart but the current selection if any. ",
7373
)
7474

7575
control_bar = Box(
@@ -88,19 +88,28 @@ def render_panel(
8888
id="error_message", style={"color": "red"}, children=[""]
8989
)
9090

91-
note = Typography(
92-
id="note",
91+
instructions = Typography(
92+
id="instructions",
9393
children=[
94-
"NOTE: Only add a maximum of 10 spectrum plots at a time as older "
95-
"ones are removed. When switching from 'Add' to 'Update' mode, "
96-
"the existing bar plots will be cleared if any."
94+
"Choose an exploration mode and select points to visualize their spectral "
95+
"reflectance across available wavelengths in this highly dynamic Spectrum View.",
9796
],
97+
variant="body2",
98+
)
99+
note_text = Markdown(
100+
text="**NOTE**: Only 10 spectrum plots can be added at a time as older "
101+
"ones are removed. When switching from **Add** to **Update** "
102+
"mode, the existing bar plots will be cleared if any."
103+
)
104+
note = Typography(
105+
id="note",
106+
children=[note_text],
107+
variant="body2",
98108
)
99109

100110
return Box(
101111
children=[
102-
"Choose an exploration mode and select points to visualize their spectral "
103-
"reflectance across available wavelengths in this highly dynamic Spectrum View.",
112+
instructions,
104113
note,
105114
control_bar,
106115
error_message,
@@ -354,6 +363,7 @@ def create_chart_from_data(data: pd.DataFrame) -> alt.Chart:
354363
color="Legend:N",
355364
tooltip=["places", "variable", "wavelength", "reflectance"],
356365
)
366+
.configure_legend(orient="bottom", columns=2)
357367
.properties(width="container", height="container")
358368
)
359369

@@ -367,7 +377,9 @@ def create_chart_from_data(data: pd.DataFrame) -> alt.Chart:
367377
color="Legend:N",
368378
tooltip=["places", "variable", "wavelength", "reflectance"],
369379
)
370-
).properties(width="container", height="container")
380+
.configure_legend(orient="bottom", columns=2)
381+
.properties(width="container", height="container")
382+
)
371383

372384

373385
def add_place_data_to_existing(

0 commit comments

Comments
 (0)