Skip to content

Commit 5a3d487

Browse files
author
Xing Han Lu
authored
Merge branch 'master' into update-vehicle-geometry
Former-commit-id: 749381d
2 parents 5e9f35e + e4f30c4 commit 5a3d487

36 files changed

+11409
-24
lines changed

apps/dash-turbine-maintenance/app.py

Lines changed: 78 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def logo(app):
207207
color="#fec036",
208208
style={"color": "#black"},
209209
backgroundColor="#2b2b2b",
210-
value="12345.67",
210+
value="0.0",
211211
)
212212
],
213213
style={
@@ -232,7 +232,7 @@ def logo(app):
232232
"on the graph and estimated RUL. In order to estimate the RUL, use "
233233
"the button 'Get New Data' and then, 'Predict'. The estimated RUL will be "
234234
"printed.",
235-
rows=10,
235+
rows=8,
236236
style={
237237
"width": "100%",
238238
"height": "100%",
@@ -278,15 +278,17 @@ def logo(app):
278278
max=max(
279279
df["WEC: ava. blade angle A"]
280280
), # This one should be the theoretical maximum
281-
value=100,
281+
value=0,
282282
showCurrentValue=True,
283283
color="#fec036",
284284
style={
285+
"align": "center",
285286
"display": "flex",
286287
"marginTop": "5%",
287288
"marginBottom": "-10%",
288289
},
289290
),
291+
className="m-auto",
290292
style={
291293
"display": "flex",
292294
"backgroundColor": "black",
@@ -295,6 +297,7 @@ def logo(app):
295297
},
296298
)
297299
],
300+
className="d-flex",
298301
style={
299302
"backgroundColor": "black",
300303
"border-radius": "1px",
@@ -332,11 +335,13 @@ def logo(app):
332335
showCurrentValue=True,
333336
color="#fec036",
334337
style={
338+
"align": "center",
335339
"display": "flex",
336340
"marginTop": "5%",
337341
"marginBottom": "-10%",
338342
},
339343
),
344+
className="m-auto",
340345
style={
341346
"display": "flex",
342347
"backgroundColor": "black",
@@ -345,6 +350,7 @@ def logo(app):
345350
},
346351
)
347352
],
353+
className="d-flex",
348354
style={
349355
"backgroundColor": "black",
350356
"border-radius": "1px",
@@ -359,8 +365,9 @@ def logo(app):
359365
active_power_from_wind_display = dbc.Card(
360366
children=[
361367
dbc.CardHeader(
362-
"Active Power Available\n from Wind [kW]",
368+
"Active Power Available from Wind [kW]",
363369
style={
370+
"display": "inline-block",
364371
"text-align": "center",
365372
"color": "white",
366373
"backgroundColor": "black",
@@ -380,11 +387,13 @@ def logo(app):
380387
showCurrentValue=True,
381388
color="#fec036",
382389
style={
390+
"align": "center",
383391
"display": "flex",
384392
"marginTop": "5%",
385393
"marginBottom": "-10%",
386394
},
387395
),
396+
className="m-auto",
388397
style={
389398
"display": "flex",
390399
"backgroundColor": "black",
@@ -393,6 +402,7 @@ def logo(app):
393402
},
394403
)
395404
],
405+
className="d-flex",
396406
style={
397407
"backgroundColor": "black",
398408
"border-radius": "1px",
@@ -429,11 +439,13 @@ def logo(app):
429439
showCurrentValue=True,
430440
color="#fec036",
431441
style={
442+
"align": "center",
432443
"display": "flex",
433444
"marginTop": "5%",
434445
"marginBottom": "-10%",
435446
},
436447
),
448+
className="m-auto",
437449
style={
438450
"display": "flex",
439451
"backgroundColor": "black",
@@ -442,6 +454,7 @@ def logo(app):
442454
},
443455
)
444456
],
457+
className="d-flex",
445458
style={
446459
"backgroundColor": "black",
447460
"border-radius": "1px",
@@ -478,11 +491,13 @@ def logo(app):
478491
showCurrentValue=True,
479492
color="#fec036",
480493
style={
494+
"align": "center",
481495
"display": "flex",
482496
"marginTop": "5%",
483497
"marginBottom": "-10%",
484498
},
485499
),
500+
className="m-auto",
486501
style={
487502
"display": "flex",
488503
"backgroundColor": "black",
@@ -491,6 +506,7 @@ def logo(app):
491506
},
492507
)
493508
],
509+
className="d-flex",
494510
style={
495511
"backgroundColor": "black",
496512
"border-radius": "1px",
@@ -502,33 +518,77 @@ def logo(app):
502518
style={"height": "95%"},
503519
)
504520

521+
gauge_size = "auto"
505522
app.layout = dbc.Container(
506523
fluid=True,
507524
children=[
508525
logo(app),
509526
dbc.Row(
510527
[
511-
dbc.Col(graphs, width=10),
528+
dbc.Col(graphs, xs=10, md=10, lg=10, width=10),
512529
dbc.Col(
513530
[
514-
dbc.Row(dbc.Col(rul_estimation_indicator, width=12)),
515-
dbc.Row(dbc.Col(info_box, width=12)),
516-
dbc.Row(dbc.Col(get_new_information_button, width=12)),
517-
dbc.Row(dbc.Col(predict_button, width=12)),
531+
dbc.Row(
532+
dbc.Col(
533+
rul_estimation_indicator, xs=12, md=12, lg=12, width=12
534+
)
535+
),
536+
dbc.Row(dbc.Col(info_box, xs=12, md=12, lg=12, width=12)),
537+
dbc.Row(
538+
dbc.Col(
539+
get_new_information_button,
540+
xs=12,
541+
md=12,
542+
lg=12,
543+
width=12,
544+
)
545+
),
546+
dbc.Row(dbc.Col(predict_button, xs=12, md=12, lg=12, width=12)),
518547
]
519548
),
520549
],
521-
style={"display": "flex", "marginBottom": "-3%",},
550+
justify="start",
551+
style={"display": "flex", "marginBottom": "-3%"},
522552
),
523553
dbc.Row(
524554
[
525-
dbc.Col(active_power_display, width="auto"),
526-
dbc.Col(active_power_from_wind_display, width="auto"),
527-
dbc.Col(reactive_power_display, width="auto"),
528-
dbc.Col(wind_speed_information, width="auto"),
529-
dbc.Col(blade_angle_display, width="auto"),
555+
dbc.Col(
556+
active_power_display,
557+
xs=gauge_size,
558+
md=gauge_size,
559+
lg=gauge_size,
560+
width=gauge_size,
561+
),
562+
dbc.Col(
563+
active_power_from_wind_display,
564+
xs=gauge_size,
565+
md=gauge_size,
566+
lg=gauge_size,
567+
width=gauge_size,
568+
),
569+
dbc.Col(
570+
reactive_power_display,
571+
xs=gauge_size,
572+
md=gauge_size,
573+
lg=gauge_size,
574+
width=gauge_size,
575+
),
576+
dbc.Col(
577+
wind_speed_information,
578+
xs=gauge_size,
579+
md=gauge_size,
580+
lg=gauge_size,
581+
width=gauge_size,
582+
),
583+
dbc.Col(
584+
blade_angle_display,
585+
xs=gauge_size,
586+
md=gauge_size,
587+
lg=gauge_size,
588+
width=gauge_size,
589+
),
530590
],
531-
style={"marginRight": "10%"},
591+
style={"marginTop": "3%"},
532592
),
533593
],
534594
)
@@ -590,7 +650,7 @@ def fig_update_layout(fig):
590650
)
591651
def update_graph(selected_column, start_date, end_date, n_get_new_info, n_pred):
592652
if n_pred is None: # here is my work before prediction button is activated.
593-
value_rul = 123456.7
653+
value_rul = 0.0
594654
information_update = (
595655
"This field is used to display information about a feature displayed "
596656
"on the graph and estimated RUL. In order to estimate the RUL, use "
@@ -723,7 +783,7 @@ def update_graph(selected_column, start_date, end_date, n_get_new_info, n_pred):
723783
return fig, value_rul, _information_update
724784
else:
725785
if n_get_new_info is None:
726-
value_rul = 123456.7
786+
value_rul = 0.0
727787
information_update = "To predict RUL, please use 'Get New Data' button."
728788
if selected_column in list(df):
729789
if start_date and end_date:
Loading

apps/dash-vtk-explorer/demos/pyvista-point-cloud/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
dash-vtk
33
pyvista
44
numpy
5+
vtk

apps/dash-vtk-explorer/demos/pyvista-terrain-following-mesh/app.py

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from dash.dependencies import Input, Output, State
77

88
import random
9+
import json
910
import numpy as np
1011
import pyvista as pv
1112
from pyvista import examples
@@ -44,6 +45,7 @@ def updateWarp(factor=1):
4445

4546
vtk_view = dash_vtk.View(
4647
id="vtk-view",
48+
pickingModes=["hover"],
4749
children=[
4850
dash_vtk.GeometryRepresentation(
4951
id="vtk-representation",
@@ -68,8 +70,19 @@ def updateWarp(factor=1):
6870
],
6971
colorMapPreset="erdc_blue2green_muted",
7072
colorDataRange=color_range,
71-
property={"edgeVisibility": True,},
72-
)
73+
property={"edgeVisibility": True},
74+
showCubeAxes=True,
75+
cubeAxesStyle={"axisLabels": ["", "", "Altitude"]},
76+
),
77+
dash_vtk.GeometryRepresentation(
78+
id="pick-rep",
79+
actor={"visibility": False},
80+
children=[
81+
dash_vtk.Algorithm(
82+
id="pick-sphere", vtkClass="vtkSphereSource", state={"radius": 100},
83+
)
84+
],
85+
),
7386
],
7487
)
7588

@@ -96,31 +109,86 @@ def updateWarp(factor=1):
96109
value="erdc_rainbow_bright",
97110
),
98111
),
112+
dbc.Col(
113+
children=dcc.Checklist(
114+
id="toggle-cube-axes",
115+
options=[{"label": " Show axis grid", "value": "grid"},],
116+
value=[],
117+
labelStyle={"display": "inline-block"},
118+
),
119+
),
99120
],
100121
style={"height": "12%", "align-items": "center"},
101122
),
102123
html.Div(
103124
html.Div(vtk_view, style={"height": "100%", "width": "100%"}),
104125
style={"height": "88%"},
105126
),
127+
html.Pre(
128+
id="tooltip",
129+
style={
130+
"position": "absolute",
131+
"bottom": "25px",
132+
"left": "25px",
133+
"zIndex": 1,
134+
"color": "white",
135+
},
136+
),
106137
],
107138
)
108139

109140

110141
@app.callback(
111142
[
143+
Output("vtk-representation", "showCubeAxes"),
112144
Output("vtk-representation", "colorMapPreset"),
113145
Output("vtk-representation", "colorDataRange"),
114146
Output("vtk-polydata", "points"),
115147
Output("vtk-polydata", "polys"),
116148
Output("vtk-array", "values"),
117149
Output("vtk-view", "triggerResetCamera"),
118150
],
119-
[Input("dropdown-preset", "value"), Input("scale-factor", "value")],
151+
[
152+
Input("dropdown-preset", "value"),
153+
Input("scale-factor", "value"),
154+
Input("toggle-cube-axes", "value"),
155+
],
120156
)
121-
def updatePresetName(name, scale_factor):
157+
def updatePresetName(name, scale_factor, cubeAxes):
122158
points, polys, elevation, color_range = updateWarp(scale_factor)
123-
return [name, color_range, points, polys, elevation, random.random()]
159+
return [
160+
"grid" in cubeAxes,
161+
name,
162+
color_range,
163+
points,
164+
polys,
165+
elevation,
166+
random.random(),
167+
]
168+
169+
170+
@app.callback(
171+
[
172+
Output("tooltip", "children"),
173+
Output("pick-sphere", "state"),
174+
Output("pick-rep", "actor"),
175+
],
176+
[Input("vtk-view", "clickInfo"), Input("vtk-view", "hoverInfo"),],
177+
)
178+
def onInfo(clickData, hoverData):
179+
info = hoverData if hoverData else clickData
180+
if info:
181+
if (
182+
"representationId" in info
183+
and info["representationId"] == "vtk-representation"
184+
):
185+
return (
186+
[json.dumps(info, indent=2)],
187+
{"center": info["worldPosition"]},
188+
{"visibility": True},
189+
)
190+
return dash.no_update, dash.no_update, dash.no_update
191+
return [""], {}, {"visibility": False}
124192

125193

126194
if __name__ == "__main__":
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)