Skip to content

Commit

Permalink
modify app, impove callbacks and fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ikaryss committed Feb 22, 2023
1 parent 25fb708 commit 543ac1f
Show file tree
Hide file tree
Showing 12 changed files with 952 additions and 360 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,5 @@ tech_tests.ipynb
/examples/style.css
/pyquac/random_example.py
/pyquac/example_data.csv
/pyquac/raw_test.csv
/pyquac/delete.csv
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ matplotlib = "^3.5.2"
dash-bootstrap-components = "^1.2.1"
dash-bootstrap-templates = "^1.0.7"
dash-daq = "^0.5.0"
dash-iconify = "^0.1.2"

[tool.poetry.dev-dependencies]
pytest = "^7.1.2"
Expand Down
22 changes: 22 additions & 0 deletions pyquac/assets/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -11097,4 +11097,26 @@ thead th {

.modal-content {
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.rc-slider-track {
background-color: #3459e6;
}

.rc-slider-dot-active {
border-color: #3459e6;
/* border: solid 2px red; */
}

.rc-slider-handle {
background-color: #3459e6;
border-color: #3459e6;
}

.rc-slider-handle:hover {
border-color: #3459e6;
}

.rc-slider-handle-active:active {
border-color: #3459e6;
}
62 changes: 62 additions & 0 deletions pyquac/assets/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
window.dash_clientside = Object.assign({}, window.dash_clientside, {
clientside: {
refresh_graph: function (
i,
x_click,
y_click,
click,
close_modal,
x,
y,
z,
fig,
y_scatter,
yz_scatter,
x_scatter,
xz_scatter,
line_switch,
x_title,
y_title
) {
const triggered_id = dash_clientside.callback_context.triggered.map(
(t) => t.prop_id
)[0];

if (fig === undefined) {
return window.dash_clientside.no_update;
}
figure = JSON.parse(JSON.stringify(fig));

if (x_click === undefined) {
figure["layout"]["shapes"][0]["visible"] = false;
figure["layout"]["shapes"][1]["visible"] = false;
} else {
figure["layout"]["shapes"][0]["visible"] = line_switch;
figure["layout"]["shapes"][1]["visible"] = line_switch;
}
if (triggered_id === "interval-graph-update.n_intervals") {
figure["data"][0]["x"] = x;
figure["data"][0]["y"] = y;
figure["data"][0]["z"] = z;
}
if (triggered_id === "heatmap.clickData") {
figure["data"][1]["x"] = yz_scatter;
figure["data"][1]["y"] = y_scatter;

figure["data"][2]["x"] = x_scatter;
figure["data"][2]["y"] = xz_scatter;

figure["layout"]["shapes"][0]["x0"] = x_click;
figure["layout"]["shapes"][0]["x1"] = x_click;

figure["layout"]["shapes"][1]["y0"] = y_click;
figure["layout"]["shapes"][1]["y1"] = y_click;
}
if (triggered_id === "modal_close.n_clicks") {
figure["layout"]["xaxis"]["title"]["text"] = x_title;
figure["layout"]["yaxis"]["title"]["text"] = y_title;
}
return figure;
},
},
});
4 changes: 3 additions & 1 deletion pyquac/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

from .navbar import navbar
from .sidebar import sidebar, content
from .property_nav import property_nav
from .modal import modal

# from .property_nav import property_nav
Loading

0 comments on commit 543ac1f

Please sign in to comment.