scatter.html
59 lines
| 1.9 KiB
| text/html
|
HtmlDjangoLexer
r5 | {% extends 'base.html' %} {% load bootstrap3 %} {% block content %} | ||
<div id="plot"></div> | |||
r0 | |||
|
r11 | {% endblock content %} | |
{% block modal %} | |||
<!-- Modal --> | |||
<div class="modal fade" id="setup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |||
<div class="modal-dialog modal-sm" role="document"> | |||
<div class="modal-content"> | |||
<div class="modal-header"> | |||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | |||
<span aria-hidden="true">×</span> | |||
</button> | |||
<h4 class="modal-title" id="myModalLabel">Setup plot</h4> | |||
</div> | |||
<div class="modal-body"> | |||
{% if code and plot %} | |||
<form id="form_setup"> | |||
{% bootstrap_form setup_form layout='grid' size='small' %} | |||
</form> | |||
{% endif %} | |||
</div> | |||
<div class="modal-footer"> | |||
<button id="bt_update" type="button" class="btn btn-primary">Update</button> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
{% endblock modal%} | |||
{% block script %} | |||
r5 | <script> | ||
|
r11 | /* This conditional is used to know if we have to setup the data | |
or just update the last data*/ | |||
r5 | let flag = true; | ||
r0 | |||
r5 | function plot(data) { | ||
// console.log(data['time']); | |||
if (flag === true) { | |||
flag = false; | |||
plt = new Scatter({ | |||
div: 'plot', | |||
data: data, | |||
key: '{{plot}}', | |||
props: { title: '{{title}}', ylabel: 'Noise [dB]', ymin: 10, ymax: 30 }, | |||
}); | |||
return true; | |||
} else { | |||
plt.update(data); | |||
return false; | |||
r0 | } | ||
r5 | } | ||
|
r11 | /*It is the button to make changes in my plot parameters defined in block modal*/ | |
$("#bt_update").click(function () { | |||
$("#setup").modal('hide'); | |||
var values = $("#form_setup").serializeArray(); | |||
plt.restyle(values); | |||
}); | |||
r5 | </script> {% endblock script %} |