Skip to content

Commit

Permalink
Migrated task of resetting to the javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
GarreBrenn committed Sep 14, 2020
1 parent aa9bd51 commit d61f112
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,6 @@ protected void initialize() {
fireEventOnChanged(unctBarsRadioButton.selectedProperty(), unctBarsRadioButton, PlotOption.UNCTBARS);
fireEventOnChanged(showUnincludedCheckBox.selectedProperty(), showUnincludedCheckBox, PlotOption.SHOW_UNINCLUDED);

/*
uncertaintyComboBox.valueProperty().addListener(new ChangeListener<Uncertainty>() {
@Override
public void changed(ObservableValue<? extends Uncertainty> observable, Uncertainty oldValue, Uncertainty newValue) {
if (resetViewOnChangeUnc.isSelected()) {
PlotGenerator.plot.call(PlotFunction.Scatter.RECENTER);
PlotGenerator.plot.call(PlotFunction.Scatter.RECENTER);
System.out.println(resetViewOnChangeUnc.isSelected() + "balasdfokjasdf");
}
}
});
*/


fireEventOnChanged(pointsFillValue, pointsFillColorPicker, PlotOption.POINTS_FILL);
fireEventOnChanged(pointsOpacityValue, pointsFillColorPicker, PlotOption.POINTS_OPACITY);
fireEventOnChanged(ellipsesFillValue, ellipsesFillColorPicker, PlotOption.ELLIPSES_FILL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ static <T> void fireEventOnChangedAndResetView(Property<T> property, CheckBox ch
if (checkBox.isSelected()) {
System.out.println("Checkbox is selected and fireEvent() was called");
Event.fireEvent(target, new OptionChangeEvent<>(plotOption, oldValue, newValue));
PlotGenerator.plot.call(PlotFunction.Scatter.RECENTER);
Event.fireEvent(target, new OptionChangeEvent<>(PlotOption.RESET_VIEW_ON_CHANGE_UNC, false, true));
//PlotGenerator.plot.update();
//PlotGenerator.plot.call(PlotFunction.Scatter.RECENTER);
}
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +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> RESET_VIEW_ON_CHANGE_UNC = booleanValue("reset_view_on_change_unc", false);

public static final PlotOption<Boolean> POINTS = booleanValue("points", true);
public static final PlotOption<String> POINTS_FILL = stringValue("points_fill", "steelblue");
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 @@ -15757,6 +15759,10 @@ class ScatterPlot extends plot_abstract_1.default {
this.features["tera-wasserburg"] = new concordia_1.TeraWasserburgConcordia();
this.features["evolution"] = new evolution_1.EvolutionMatrix();
this.features[const_1.Feature.MCLEAN_REGRESSION] = new mclean_regression_1.McLeanRegression();
if (this.options.reset_view_on_change_unc) {
this.update();
this.options.reset_view_on_change_unc = false;
}
this.update();
}
resize() {
Expand Down

0 comments on commit d61f112

Please sign in to comment.