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

Reset view java #482

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class DataOptionsController extends AnchorPane {
@FXML ColorPicker unctBarsFillColorPicker;

@FXML CheckBox showUnincludedCheckBox;
@FXML CheckBox resetViewOnChangeUnc;

private ToggleGroup uncertaintyToggleGroup = new ToggleGroup();

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -142,6 +144,7 @@ public DataOptionsController() {

uncertaintyCheckBox.fire();
showUnincludedCheckBox.fire();
resetViewOnChangeUnc.fire();

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@
<Insets />
</VBox.margin>
</CheckBox>
<CheckBox fx:id="resetViewOnChangeUnc" mnemonicParsing="false" text="Reset View when Uncertainty is Changed" underline="true">
<VBox.margin>
<Insets />
</VBox.margin>
</CheckBox>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static PlotOption<?> forKey(String key) {
public static final PlotOption<Number> R238_235S = numberValue("R238_235S", 137.88);

public static final PlotOption<Boolean> SHOW_UNINCLUDED = booleanValue("show_unincluded", true);
public static final PlotOption<Boolean> RESET_VIEW_ON_CHANGE_UNC = booleanValue("reset_view_on_change_unc", true);

public static final PlotOption<Boolean> POINTS = booleanValue("points", true);
public static final PlotOption<String> POINTS_FILL = stringValue("points_fill", "steelblue");
Expand Down Expand Up @@ -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,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down