diff --git a/numass-storage/src/main/java/inr/numass/storage/NumassDataLoader.java b/numass-storage/src/main/java/inr/numass/storage/NumassDataLoader.java index 57390e6d..c017d43e 100644 --- a/numass-storage/src/main/java/inr/numass/storage/NumassDataLoader.java +++ b/numass-storage/src/main/java/inr/numass/storage/NumassDataLoader.java @@ -37,6 +37,7 @@ import java.time.Instant; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -169,7 +170,7 @@ public class NumassDataLoader extends AbstractLoader implements BinaryLoader getNMPoints() { List res = new ArrayList<>(); - this.getPoints().stream().forEach((point) -> { + this.getPoints().stream().forEachOrdered((point) -> { res.add(readPoint(point)); }); // res.sort((NMPoint o1, NMPoint o2) -> o1.getAbsouteTime().compareTo(o2.getAbsouteTime())); @@ -256,6 +257,10 @@ public class NumassDataLoader extends AbstractLoader implements BinaryLoader t.meta().getInt("external_meta.point_index", -1) + .compareTo(t1.meta().getInt("external_meta.point_index", -1))); + return res; } diff --git a/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java b/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java index 8d20c482..9db96c95 100644 --- a/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java +++ b/numass-viewer/src/main/java/inr/numass/viewer/MspViewController.java @@ -213,7 +213,7 @@ public class MspViewController implements Initializable { p.putValue("timestamp", last.getValue("timestamp").timeValue().plusMillis(10)); for (String name : last.namesAsArray()) { if (!name.equals("timestamp")) { - p.putValue(name, Value.getNull()); + p.putValue(name, Value.NULL); } } return p; diff --git a/numass-viewer/src/main/java/inr/numass/viewer/NumassLoaderViewComponent.java b/numass-viewer/src/main/java/inr/numass/viewer/NumassLoaderViewComponent.java index 05215f3a..03297b10 100644 --- a/numass-viewer/src/main/java/inr/numass/viewer/NumassLoaderViewComponent.java +++ b/numass-viewer/src/main/java/inr/numass/viewer/NumassLoaderViewComponent.java @@ -147,14 +147,14 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab detectorDataExportButton.setOnAction(this::onExportButtonClick); lowChannelField.textProperty().bindBidirectional(channelSlider.lowValueProperty(), new NumberStringConverter()); upChannelField.textProperty().bindBidirectional(channelSlider.highValueProperty(), new NumberStringConverter()); - + channelSlider.setLowValue(300); channelSlider.setHighValue(1900); - + ChangeListener rangeChangeListener = (ObservableValue observable, Number oldValue, Number newValue) -> { updateSpectrumPane(); }; - + channelSlider.lowValueProperty().addListener(rangeChangeListener); channelSlider.highValueProperty().addListener(rangeChangeListener); } @@ -209,11 +209,18 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab private void updateSpectrumPane() { if (spectrumPlotFrame == null) { - spectrumPlotFrame = new JFreeChartFrame("spectrum", null, spectrumPlotPane); + Meta plotMeta = new MetaBuilder("plot") + .setValue("xAxis.axisTitle", "U") + .setValue("xAxis.axisUnits", "V") + .setValue("yAxis.axisTitle", "count rate") + .setValue("yAxis.axisUnits", "Hz") + .setValue("legend.show", false); + + spectrumPlotFrame = new JFreeChartFrame("spectrum", plotMeta, spectrumPlotPane); } if (spectrumData == null) { - spectrumData = new ChangeablePlottableData("", null); + spectrumData = new ChangeablePlottableData("spectrum", null); spectrumPlotFrame.add(spectrumData); }