Private
Public Access
1
0

dynamic form for trendflex/boxplot combo

This commit is contained in:
Sander Roosendaal
2019-04-28 18:02:44 +02:00
parent f1888ab9fa
commit 5d18644f9e
4 changed files with 145 additions and 61 deletions

View File

@@ -63,6 +63,78 @@
});
</script>
<script>
// script for chart options form
$(function() {
// Get the form fields and hidden div
var functionfield = $("#id_function");
var plotfield = $("#id_plotfield").parent().parent();
var x_param = $("#id_xparam").parent().parent();
var y_param = $("#id_yparam").parent().parent();
var groupby = $("#id_groupby").parent().parent();
var binsize = $("#id_binsize").parent().parent();
var errorbars = $("#id_ploterrorbars").parent().parent();
var palette = $("#id_palette").parent().parent();
// Hide the fields.
// Use JS to do this in case the user doesn't have JS
// enabled.
plotfield.hide();
x_param.hide();
y_param.hide();
groupby.hide();
errorbars.hide();
palette.hide();
binsize.hide();
if (functionfield.val() == 'boxplot') {
plotfield.show();
};
if (functionfield.val() == 'trendflex') {
x_param.show();
y_param.show();
groupby.show();
palette.show();
binsize.show();
errorbars.show();
};
// Setup an event listener for when the state of the
// checkbox changes.
functionfield.change(function() {
// Check to see if the checkbox is checked.
// If it is, show the fields and populate the input.
// If not, hide the fields.
var Value = functionfield.val();
if (Value=='boxplot') {
// Show the hidden fields.
plotfield.show();
x_param.hide();
y_param.hide();
groupby.hide();
palette.hide();
binsize.hide();
errorbars.hide();
}
else if (Value=='trendflex') {
x_param.show();
y_param.show();
groupby.show();
palette.show();
binsize.show();
errorbars.show();
plotfield.hide();
}
});
});
</script>
<script src="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.js"></script>
<script async="true" type="text/javascript">
Bokeh.set_log_level("info");