dynamic form for trendflex/boxplot combo
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user