diff --git a/topsoilApp/src/main/java/org/cirdles/topsoil/app/control/plot/panel/DataOptionsController.java b/topsoilApp/src/main/java/org/cirdles/topsoil/app/control/plot/panel/DataOptionsController.java index 3e00ba21..8d5417fb 100644 --- a/topsoilApp/src/main/java/org/cirdles/topsoil/app/control/plot/panel/DataOptionsController.java +++ b/topsoilApp/src/main/java/org/cirdles/topsoil/app/control/plot/panel/DataOptionsController.java @@ -46,6 +46,7 @@ public class DataOptionsController extends AnchorPane { @FXML ColorPicker unctBarsFillColorPicker; @FXML CheckBox showUnincludedCheckBox; + @FXML CheckBox resetViewOnChangeUnc; private ToggleGroup uncertaintyToggleGroup = new ToggleGroup(); @@ -82,7 +83,7 @@ public DataOptionsController() { // Populate Uncertainty ComboBox uncertaintyComboBox.getItems().addAll(Uncertainty.ONE_SIGMA_ABSOLUTE, Uncertainty .TWO_SIGMA_ABSOLUTE, Uncertainty.NINETY_FIVE_PERCENT_CONFIDENCE); - uncertaintyComboBox.getSelectionModel().select(Uncertainty.ONE_SIGMA_ABSOLUTE); + uncertaintyComboBox.getSelectionModel().select(Uncertainty.TWO_SIGMA_ABSOLUTE); // Configure ellipses/unctbars RadioButtons RadioButtonSelectionHandler ellipsesSelectionHandler = new RadioButtonSelectionHandler(ellipsesRadioButton); @@ -132,6 +133,7 @@ public DataOptionsController() { fireEventOnChanged(ellipsesRadioButton.selectedProperty(), ellipsesRadioButton, PlotOption.ELLIPSES); fireEventOnChanged(unctBarsRadioButton.selectedProperty(), unctBarsRadioButton, PlotOption.UNCTBARS); fireEventOnChanged(showUnincludedCheckBox.selectedProperty(), showUnincludedCheckBox, PlotOption.SHOW_UNINCLUDED); + fireEventOnChanged(resetViewOnChangeUnc.selectedProperty(), resetViewOnChangeUnc, PlotOption.RESET_VIEW_ON_CHANGE_UNC); fireEventOnChanged(pointsFillValue, pointsFillColorPicker, PlotOption.POINTS_FILL); fireEventOnChanged(pointsOpacityValue, pointsFillColorPicker, PlotOption.POINTS_OPACITY); @@ -142,6 +144,7 @@ public DataOptionsController() { uncertaintyCheckBox.fire(); showUnincludedCheckBox.fire(); + resetViewOnChangeUnc.fire(); } diff --git a/topsoilApp/src/main/java/org/cirdles/topsoil/app/control/plot/panel/PlotOptionsPanel.java b/topsoilApp/src/main/java/org/cirdles/topsoil/app/control/plot/panel/PlotOptionsPanel.java index e880404d..383983e4 100644 --- a/topsoilApp/src/main/java/org/cirdles/topsoil/app/control/plot/panel/PlotOptionsPanel.java +++ b/topsoilApp/src/main/java/org/cirdles/topsoil/app/control/plot/panel/PlotOptionsPanel.java @@ -259,6 +259,7 @@ private void setUpdateActions() { updateActions.put(ISOTOPE_SYSTEM, (value) -> dataOptions.isotopeSystemComboBox.getSelectionModel().select((IsotopeSystem) value)); updateActions.put(UNCERTAINTY, (value) -> dataOptions.uncertaintyComboBox.getSelectionModel().select((Uncertainty) value)); + updateActions.put(RESET_VIEW_ON_CHANGE_UNC, (value) -> dataOptions.resetViewOnChangeUnc.setSelected((Boolean) value)); updateActions.put(SHOW_UNINCLUDED, (value) -> dataOptions.showUnincludedCheckBox.setSelected((Boolean) value)); updateActions.put(POINTS, (value) -> dataOptions.pointsCheckBox.setSelected((Boolean) value)); updateActions.put(POINTS_FILL, (value) -> dataOptions.pointsFillColorPicker.setValue( diff --git a/topsoilApp/src/main/resources/org/cirdles/topsoil/app/control/plot/panel/data-options-menu.fxml b/topsoilApp/src/main/resources/org/cirdles/topsoil/app/control/plot/panel/data-options-menu.fxml index 297386bc..ccae790d 100644 --- a/topsoilApp/src/main/resources/org/cirdles/topsoil/app/control/plot/panel/data-options-menu.fxml +++ b/topsoilApp/src/main/resources/org/cirdles/topsoil/app/control/plot/panel/data-options-menu.fxml @@ -153,6 +153,11 @@ + + + + + diff --git a/topsoilCore/src/main/java/org/cirdles/topsoil/plot/PlotOption.java b/topsoilCore/src/main/java/org/cirdles/topsoil/plot/PlotOption.java index 336b74a9..c71e4a39 100644 --- a/topsoilCore/src/main/java/org/cirdles/topsoil/plot/PlotOption.java +++ b/topsoilCore/src/main/java/org/cirdles/topsoil/plot/PlotOption.java @@ -49,6 +49,7 @@ public static PlotOption forKey(String key) { public static final PlotOption R238_235S = numberValue("R238_235S", 137.88); public static final PlotOption SHOW_UNINCLUDED = booleanValue("show_unincluded", true); + public static final PlotOption RESET_VIEW_ON_CHANGE_UNC = booleanValue("reset_view_on_change_unc", true); public static final PlotOption POINTS = booleanValue("points", true); public static final PlotOption POINTS_FILL = stringValue("points_fill", "steelblue"); @@ -90,7 +91,7 @@ public static PlotOption forKey(String key) { LAMBDA_U234, LAMBDA_U235, LAMBDA_U238, LAMBDA_TH230, R238_235S, - SHOW_UNINCLUDED, + SHOW_UNINCLUDED, RESET_VIEW_ON_CHANGE_UNC, POINTS, POINTS_FILL, POINTS_OPACITY, diff --git a/topsoilCore/src/main/resources/org/cirdles/topsoil/plot/topsoil.js b/topsoilCore/src/main/resources/org/cirdles/topsoil/plot/topsoil.js index 686cb2de..d33b2c50 100644 --- a/topsoilCore/src/main/resources/org/cirdles/topsoil/plot/topsoil.js +++ b/topsoilCore/src/main/resources/org/cirdles/topsoil/plot/topsoil.js @@ -14150,7 +14150,7 @@ const ELLIPSE_CLASS = "ellipse"; exports.Ellipses = { draw(plot) { const { ellipses_fill: fill, ellipses_opacity: opacity, uncertainty } = plot.options; - console.log("uncertaintyE: " + uncertainty + " typeOf: " + typeof uncertainty); + console.log("options.reset_: " + plot.options.reset_view_on_change_unc); const layerToDrawOn = plots_1.findLayer(plot, plots_1.Feature.ELLIPSES); const ellipses = layerToDrawOn.selectAll("." + ELLIPSE_CLASS).data(calcEllipses(plot.data, uncertainty)); ellipses.exit().remove(); @@ -14441,6 +14441,7 @@ class McLeanRegression { lowerEnvelope.attr("d", lineGenerator(this.envelopeLowerBound)); upperEnvelope.attr("d", lineGenerator(this.envelopeUpperBound)); } + info.text("this: " + plot.options.reset_view_on_change_unc); let leftText = plot.leftTextSVGElement; leftText.text("Slope: " + regression.getRoundedSlope(5) + ", y-intercept: " + regression.getRoundedIntercept(5)); } @@ -15431,6 +15432,7 @@ var Option; Option["LAMBDA_238"] = "lambda_238"; Option["R238_235S"] = "R238_235S"; Option["SHOW_UNINCLUDED"] = "show_unincluded"; + Option["RESET_VIEW_ON_CHANGE_UNC"] = "reset_view_on_change_unc"; Option["POINTS"] = "points"; Option["POINTS_FILL"] = "points_fill"; Option["POINTS_OPACITY"] = "points_opacity"; @@ -15857,6 +15859,18 @@ class ScatterPlot extends plot_abstract_1.default { this.javaBridge.syncAxes(xDomain[0], xDomain[1], yDomain[0], yDomain[1]); } } + set options(options) { + super.options = options; + //this._options = options; + if (options.uncertainty != this._options.uncertainty + && options.reset_view_on_change_unc) { + this.resetView(); + } + this.update(); + } + get options() { + return super.options; + } getDataExtents() { const extents = [1000000, -1000000, 1000000, -1000000]; let sigmaX, sigmaY;