Fixed XY plots

This commit is contained in:
Alexander Nozik 2016-09-26 11:37:03 +03:00
parent c8651e0f26
commit 2aecfdbced
3 changed files with 7 additions and 7 deletions

View File

@ -13,8 +13,8 @@ import hep.dataforge.meta.Meta;
import hep.dataforge.meta.MetaBuilder; import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.plots.PlotsPlugin; import hep.dataforge.plots.PlotsPlugin;
import hep.dataforge.plots.XYPlotFrame; import hep.dataforge.plots.XYPlotFrame;
import hep.dataforge.plots.data.XYPlottable;
import hep.dataforge.plots.data.PlottableData; import hep.dataforge.plots.data.PlottableData;
import hep.dataforge.plots.data.XYPlottable;
import hep.dataforge.tables.*; import hep.dataforge.tables.*;
import hep.dataforge.values.ValueType; import hep.dataforge.values.ValueType;
import inr.numass.storage.NMPoint; import inr.numass.storage.NMPoint;
@ -105,7 +105,7 @@ public class ShowEnergySpectrumAction extends OneToOneAction<NumassData, Table>
index++; index++;
String seriesName = String.format("%d: %s", index, entry.getKey()); String seriesName = String.format("%d: %s", index, entry.getKey());
String[] nameList = {"x", "y"}; String[] nameList = {XYAdapter.X_VALUE_KEY, XYAdapter.Y_VALUE_KEY};
List<DataPoint> data = entry.getValue().entrySet().stream() List<DataPoint> data = entry.getValue().entrySet().stream()
.map(e -> new MapPoint(nameList, e.getKey(), e.getValue())) .map(e -> new MapPoint(nameList, e.getKey(), e.getValue()))
.collect(Collectors.toList()); .collect(Collectors.toList());

View File

@ -64,14 +64,14 @@ public class SpectrumDataAdapter extends XYAdapter {
} }
public DataPoint buildSpectrumDataPoint(double x, long count, double t) { public DataPoint buildSpectrumDataPoint(double x, long count, double t) {
return new MapPoint(new String[]{getValueName(X_VALUE_KEY), getValueName(Y_VALUE_KEY), return new MapPoint(new String[]{nameFor(X_VALUE_KEY), nameFor(Y_VALUE_KEY),
getValueName(POINT_LENGTH_NAME)}, nameFor(POINT_LENGTH_NAME)},
x, count, t); x, count, t);
} }
public DataPoint buildSpectrumDataPoint(double x, long count, double countErr, double 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), return new MapPoint(new String[]{nameFor(X_VALUE_KEY), nameFor(Y_VALUE_KEY),
getValueName(Y_ERROR_KEY), getValueName(POINT_LENGTH_NAME)}, nameFor(Y_ERROR_KEY), nameFor(POINT_LENGTH_NAME)},
x, count, countErr, t); x, count, countErr, t);
} }

View File

@ -312,7 +312,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
private DataPoint getSpectrumPoint(NMPoint point, int lowChannel, int upChannel, double dTime) { private DataPoint getSpectrumPoint(NMPoint point, int lowChannel, int upChannel, double dTime) {
double u = point.getUread(); 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.countRateWithDeadTime(point,lowChannel, upChannel, dTime),
TritiumUtils.countRateWithDeadTimeErr(point,lowChannel, upChannel, dTime)); TritiumUtils.countRateWithDeadTimeErr(point,lowChannel, upChannel, dTime));
} }