From 2aecfdbced44a9badf76e5be4e2100489805bed7 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 26 Sep 2016 11:37:03 +0300 Subject: [PATCH] Fixed XY plots --- .../java/inr/numass/actions/ShowEnergySpectrumAction.java | 4 ++-- .../main/java/inr/numass/data/SpectrumDataAdapter.java | 8 ++++---- .../java/inr/numass/viewer/NumassLoaderViewComponent.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/numass-main/src/main/java/inr/numass/actions/ShowEnergySpectrumAction.java b/numass-main/src/main/java/inr/numass/actions/ShowEnergySpectrumAction.java index 8cf17981..426a89f5 100644 --- a/numass-main/src/main/java/inr/numass/actions/ShowEnergySpectrumAction.java +++ b/numass-main/src/main/java/inr/numass/actions/ShowEnergySpectrumAction.java @@ -13,8 +13,8 @@ import hep.dataforge.meta.Meta; import hep.dataforge.meta.MetaBuilder; import hep.dataforge.plots.PlotsPlugin; import hep.dataforge.plots.XYPlotFrame; -import hep.dataforge.plots.data.XYPlottable; import hep.dataforge.plots.data.PlottableData; +import hep.dataforge.plots.data.XYPlottable; import hep.dataforge.tables.*; import hep.dataforge.values.ValueType; import inr.numass.storage.NMPoint; @@ -105,7 +105,7 @@ public class ShowEnergySpectrumAction extends OneToOneAction index++; String seriesName = String.format("%d: %s", index, entry.getKey()); - String[] nameList = {"x", "y"}; + String[] nameList = {XYAdapter.X_VALUE_KEY, XYAdapter.Y_VALUE_KEY}; List data = entry.getValue().entrySet().stream() .map(e -> new MapPoint(nameList, e.getKey(), e.getValue())) .collect(Collectors.toList()); diff --git a/numass-main/src/main/java/inr/numass/data/SpectrumDataAdapter.java b/numass-main/src/main/java/inr/numass/data/SpectrumDataAdapter.java index 836a2264..34f10cc5 100644 --- a/numass-main/src/main/java/inr/numass/data/SpectrumDataAdapter.java +++ b/numass-main/src/main/java/inr/numass/data/SpectrumDataAdapter.java @@ -64,14 +64,14 @@ public class SpectrumDataAdapter extends XYAdapter { } public DataPoint buildSpectrumDataPoint(double x, long count, double t) { - return new MapPoint(new String[]{getValueName(X_VALUE_KEY), getValueName(Y_VALUE_KEY), - getValueName(POINT_LENGTH_NAME)}, + return new MapPoint(new String[]{nameFor(X_VALUE_KEY), nameFor(Y_VALUE_KEY), + nameFor(POINT_LENGTH_NAME)}, x, count, t); } public DataPoint buildSpectrumDataPoint(double x, long count, double countErr, double t) { - return new MapPoint(new String[]{getValueName(X_VALUE_KEY), getValueName(Y_VALUE_KEY), - getValueName(Y_ERROR_KEY), getValueName(POINT_LENGTH_NAME)}, + return new MapPoint(new String[]{nameFor(X_VALUE_KEY), nameFor(Y_VALUE_KEY), + nameFor(Y_ERROR_KEY), nameFor(POINT_LENGTH_NAME)}, x, count, countErr, t); } 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 48223a59..64795281 100644 --- a/numass-viewer/src/main/java/inr/numass/viewer/NumassLoaderViewComponent.java +++ b/numass-viewer/src/main/java/inr/numass/viewer/NumassLoaderViewComponent.java @@ -312,7 +312,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab private DataPoint getSpectrumPoint(NMPoint point, int lowChannel, int upChannel, double dTime) { double u = point.getUread(); - return new MapPoint(new String[]{"x", "y", "yErr"}, u, + return new MapPoint(new String[]{XYAdapter.X_VALUE_KEY, XYAdapter.Y_VALUE_KEY, XYAdapter.Y_ERROR_KEY}, u, TritiumUtils.countRateWithDeadTime(point,lowChannel, upChannel, dTime), TritiumUtils.countRateWithDeadTimeErr(point,lowChannel, upChannel, dTime)); }