Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualizations updates #709

Merged
merged 12 commits into from
Oct 31, 2022
2 changes: 1 addition & 1 deletion frontend/assessment/DoseUnitsWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DoseUnitsWidget {
$("#pduRemove").on("click", this.handleRemove.bind(this));
$("#pduUp").on("click", this.handleUp.bind(this));
$("#pduDown").on("click", this.handleDown.bind(this));
$.get(opts.api, this.render.bind(this));
this.render(opts.choices);
}

handleAdd() {
Expand Down
7 changes: 5 additions & 2 deletions frontend/lit/TagTreeViz.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class VizOptions extends Component {
<p className="form-text text-muted" data-value={key}>
Click a node to expand to view child-nodes. Ctrl-click or ⌘-click to view references
associated with an node (except root-node). Hold shift to drag nodes to new
positions.
positions; click a node after dragging to update layout.
</p>
);
}
Expand Down Expand Up @@ -253,7 +253,9 @@ class TagTreeViz extends D3Plot {
nodeEnter
.append("svg:circle")
.attr("r", 1e-6)
.style("fill", d => (d.data.hasChildren ? "lightsteelblue" : "white"));
.style("fill", d => (d.data.hasChildren ? "lightsteelblue" : "white"))
.append("svg:title")
.text("Ctrl-click or ⌘-click to view references");

nodeEnter
.append("svg:text")
Expand Down Expand Up @@ -354,6 +356,7 @@ class TagTreeViz extends D3Plot {
};

this.add_title();
this.title.style("cursor", "pointer").call(HAWCUtils.updateDragLocationXY(h.noop));
if (options.show_legend) {
this.add_legend();
}
Expand Down
6 changes: 6 additions & 0 deletions hawc/apps/summary/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,12 @@ def __init__(self, *args, **kwargs):
(constants.StudyType.IN_VITRO, "In vitro"),
)
self.fields["preferred_units"].required = False
self.js_units_choices = json.dumps(
[
{"id": obj.id, "name": obj.name}
for obj in DoseUnits.objects.get_animal_units(self.instance.assessment)
]
)
self.helper = self.setHelper()

def save(self, commit=True):
Expand Down
5 changes: 3 additions & 2 deletions hawc/apps/summary/templates/summary/datapivot_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
{{ smart_tag_form.media }}
<script type="text/javascript">
$(document).ready(function () {
let printf = window.app.HAWCUtils.printf;
let js_units_choices = {{form.js_units_choices|safe}},
printf = window.app.HAWCUtils.printf;

{% if crud == "Create" %}
$('#id_title').on('keyup', function(){
Expand All @@ -23,7 +24,7 @@

window.app.startup("assessmentStartup", function(app){
var doseWidget = new app.DoseUnitsWidget($('form'), {
api: "{% url 'animal:api:dose_units-list' %}",
choices: js_units_choices,
el: '#id_preferred_units',
});
});
Expand Down