GUI for table display

This commit is contained in:
Alexander Nozik 2017-10-15 22:01:31 +03:00
parent c3a4873940
commit 215b5aa3aa
15 changed files with 49 additions and 51 deletions

View File

@ -19,8 +19,8 @@ import hep.dataforge.exceptions.DataFormatException;
import hep.dataforge.exceptions.NameNotFoundException; import hep.dataforge.exceptions.NameNotFoundException;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.meta.MetaBuilder; import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.tables.PointAdapter;
import hep.dataforge.tables.ValueMap; import hep.dataforge.tables.ValueMap;
import hep.dataforge.tables.ValuesAdapter;
import hep.dataforge.tables.XYAdapter; import hep.dataforge.tables.XYAdapter;
import hep.dataforge.values.Value; import hep.dataforge.values.Value;
import hep.dataforge.values.Values; import hep.dataforge.values.Values;
@ -41,7 +41,7 @@ public class SpectrumDataAdapter extends XYAdapter {
} }
public SpectrumDataAdapter(String xName, String yName, String yErrName, String measurementTime) { public SpectrumDataAdapter(String xName, String yName, String yErrName, String measurementTime) {
super(new MetaBuilder(PointAdapter.DATA_ADAPTER_KEY) super(new MetaBuilder(ValuesAdapter.DATA_ADAPTER_KEY)
.setValue(X_VALUE_KEY, xName) .setValue(X_VALUE_KEY, xName)
.setValue(Y_VALUE_KEY, yName) .setValue(Y_VALUE_KEY, yName)
.setValue(Y_ERROR_KEY, yErrName) .setValue(Y_ERROR_KEY, yErrName)
@ -51,7 +51,7 @@ public class SpectrumDataAdapter extends XYAdapter {
} }
public SpectrumDataAdapter(String xName, String yName, String measurementTime) { public SpectrumDataAdapter(String xName, String yName, String measurementTime) {
super(new MetaBuilder(PointAdapter.DATA_ADAPTER_KEY) super(new MetaBuilder(ValuesAdapter.DATA_ADAPTER_KEY)
.setValue(X_VALUE_KEY, xName) .setValue(X_VALUE_KEY, xName)
.setValue(Y_VALUE_KEY, yName) .setValue(Y_VALUE_KEY, yName)
.setValue(POINT_LENGTH_NAME, measurementTime) .setValue(POINT_LENGTH_NAME, measurementTime)

View File

@ -17,7 +17,7 @@ package inr.numass.scripts
import hep.dataforge.maths.integration.UnivariateIntegrator import hep.dataforge.maths.integration.UnivariateIntegrator
import hep.dataforge.plots.PlotFrame import hep.dataforge.plots.PlotFrame
import hep.dataforge.plots.data.PlotXYFunction import hep.dataforge.plots.data.XYFunctionPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.stat.fit.ParamSet import hep.dataforge.stat.fit.ParamSet
import inr.numass.models.LossCalculator import inr.numass.models.LossCalculator
@ -37,7 +37,7 @@ ParamSet params = new ParamSet()
UnivariateFunction scatterFunction = LossCalculator.getSingleScatterFunction(params); UnivariateFunction scatterFunction = LossCalculator.getSingleScatterFunction(params);
PlotFrame frame = JFreeChartFrame.drawFrame("Differential scatter function", null); PlotFrame frame = JFreeChartFrame.drawFrame("Differential scatter function", null);
frame.add(PlotXYFunction.plotFunction("differential", scatterFunction, 0, 100, 400)); frame.add(XYFunctionPlot.plotFunction("differential", scatterFunction, 0, 100, 400));
UnivariateIntegrator integrator = NumassContext.defaultIntegrator; UnivariateIntegrator integrator = NumassContext.defaultIntegrator;
@ -88,7 +88,7 @@ UnivariateFunction integral = {double u ->
} }
frame.add(PlotXYFunction.plotFunction("integral", integral, 0, 100, 800)); frame.add(XYFunctionPlot.plotFunction("integral", integral, 0, 100, 800));
BisectionSolver solver = new BisectionSolver(1e-3); BisectionSolver solver = new BisectionSolver(1e-3);

View File

@ -17,7 +17,7 @@ package inr.numass.scripts
import hep.dataforge.io.PrintFunction import hep.dataforge.io.PrintFunction
import hep.dataforge.maths.integration.UnivariateIntegrator import hep.dataforge.maths.integration.UnivariateIntegrator
import hep.dataforge.plots.data.PlotXYFunction import hep.dataforge.plots.data.XYFunctionPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.stat.fit.ParamSet import hep.dataforge.stat.fit.ParamSet
import inr.numass.models.ExperimentalVariableLossSpectrum import inr.numass.models.ExperimentalVariableLossSpectrum
@ -45,17 +45,17 @@ JFreeChartFrame frame = JFreeChartFrame.drawFrame("Experimental Loss Test", null
UnivariateIntegrator integrator = NumassContext.defaultIntegrator UnivariateIntegrator integrator = NumassContext.defaultIntegrator
UnivariateFunction exFunc = lsp.excitation(params.getValue("exPos"), params.getValue("exW")); UnivariateFunction exFunc = lsp.excitation(params.getValue("exPos"), params.getValue("exW"));
frame.add(PlotXYFunction.plotFunction("ex", exFunc, 0d, 50d, 500)); frame.add(XYFunctionPlot.plotFunction("ex", exFunc, 0d, 50d, 500));
println "excitation norm factor " + integrator.integrate(0, 50, exFunc) println "excitation norm factor " + integrator.integrate(0, 50, exFunc)
UnivariateFunction ionFunc = lsp.ionization(params.getValue("ionPos"), params.getValue("ionW")); UnivariateFunction ionFunc = lsp.ionization(params.getValue("ionPos"), params.getValue("ionW"));
frame.add(PlotXYFunction.plotFunction("ion", ionFunc, 0d, 50d, 500)); frame.add(XYFunctionPlot.plotFunction("ion", ionFunc, 0d, 50d, 500));
println "ionization norm factor " + integrator.integrate(0, 200, ionFunc) println "ionization norm factor " + integrator.integrate(0, 200, ionFunc)
UnivariateFunction sumFunc = lsp.singleScatterFunction(params); UnivariateFunction sumFunc = lsp.singleScatterFunction(params);
frame.add(PlotXYFunction.plotFunction("sum", sumFunc, 0d, 50d, 500)); frame.add(XYFunctionPlot.plotFunction("sum", sumFunc, 0d, 50d, 500));
println "sum norm factor " + integrator.integrate(0, 100, sumFunc) println "sum norm factor " + integrator.integrate(0, 100, sumFunc)
@ -65,4 +65,4 @@ PrintFunction.printFunctionSimple(new PrintWriter(System.out), sumFunc, 0d, 50d,
JFreeChartFrame integerFrame = JFreeChartFrame.drawFrame("Experimental Loss Test", null); JFreeChartFrame integerFrame = JFreeChartFrame.drawFrame("Experimental Loss Test", null);
UnivariateFunction integr = { d-> lsp.value(d,params)} UnivariateFunction integr = { d-> lsp.value(d,params)}
integerFrame.add(PlotXYFunction.plotFunction("integr", integr, 18950d, 19005d, 500)); integerFrame.add(XYFunctionPlot.plotFunction("integr", integr, 18950d, 19005d, 500));

View File

@ -15,7 +15,7 @@
*/ */
package inr.numass.scripts package inr.numass.scripts
import hep.dataforge.plots.data.PlotXYFunction import hep.dataforge.plots.data.XYFunctionPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import org.apache.commons.math3.analysis.UnivariateFunction import org.apache.commons.math3.analysis.UnivariateFunction
@ -43,4 +43,4 @@ UnivariateFunction excitation = excitationSpectrum(lines,0.08)
JFreeChartFrame frame = JFreeChartFrame.drawFrame("theoretical loss spectrum", null); JFreeChartFrame frame = JFreeChartFrame.drawFrame("theoretical loss spectrum", null);
frame.add(PlotXYFunction.plotFunction("excitation", excitation, 0d, 20d, 500)); frame.add(XYFunctionPlot.plotFunction("excitation", excitation, 0d, 20d, 500));

View File

@ -14,7 +14,7 @@ import hep.dataforge.grind.GrindShell
import hep.dataforge.grind.helpers.PlotHelper import hep.dataforge.grind.helpers.PlotHelper
import hep.dataforge.io.ColumnedDataWriter import hep.dataforge.io.ColumnedDataWriter
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.plots.data.PlotData import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.data.PlottableGroup import hep.dataforge.plots.data.PlottableGroup
import hep.dataforge.tables.Table import hep.dataforge.tables.Table
import hep.dataforge.tables.TableTransform import hep.dataforge.tables.TableTransform
@ -63,11 +63,11 @@ shell.eval {
//Showing selected points //Showing selected points
def showPoints = { Map points, int binning = 20, int loChannel = 300, int upChannel = 2000 -> def showPoints = { Map points, int binning = 20, int loChannel = 300, int upChannel = 2000 ->
PlottableGroup<PlotData> plotGroup = new PlottableGroup<>(); PlottableGroup<DataPlot> plotGroup = new PlottableGroup<>();
def adapter = new XYAdapter(CHANNEL_KEY, COUNT_RATE_KEY) def adapter = new XYAdapter(CHANNEL_KEY, COUNT_RATE_KEY)
points.each { points.each {
plotGroup.add( plotGroup.add(
PlotData.plot( DataPlot.plot(
it.key as String, it.key as String,
adapter, adapter,
NumassDataUtils.spectrumWithBinning(it.value as Table, binning) NumassDataUtils.spectrumWithBinning(it.value as Table, binning)

View File

@ -24,8 +24,8 @@ import hep.dataforge.meta.Laminate;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.plots.PlotFrame; import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.PlotUtils; import hep.dataforge.plots.PlotUtils;
import hep.dataforge.plots.data.PlotData; import hep.dataforge.plots.data.DataPlot;
import hep.dataforge.plots.data.PlotXYFunction; import hep.dataforge.plots.data.XYFunctionPlot;
import hep.dataforge.stat.fit.FitResult; import hep.dataforge.stat.fit.FitResult;
import hep.dataforge.stat.fit.FitState; import hep.dataforge.stat.fit.FitState;
import hep.dataforge.stat.models.XYModel; import hep.dataforge.stat.models.XYModel;
@ -69,7 +69,7 @@ public class PlotFitResultAction extends OneToOneAction<FitResult, FitResult> {
PlotFrame frame = PlotUtils.getPlotManager(context) PlotFrame frame = PlotUtils.getPlotManager(context)
.getPlotFrame(getName(), name, metaData.getMeta("plot", Meta.empty())); .getPlotFrame(getName(), name, metaData.getMeta("plot", Meta.empty()));
PlotXYFunction fit = new PlotXYFunction("fit"); XYFunctionPlot fit = new XYFunctionPlot("fit");
fit.setDensity(100, false); fit.setDensity(100, false);
fit.setSmoothing(true); fit.setSmoothing(true);
// ensuring all data points are calculated explicitly // ensuring all data points are calculated explicitly
@ -78,7 +78,7 @@ public class PlotFitResultAction extends OneToOneAction<FitResult, FitResult> {
frame.add(fit); frame.add(fit);
frame.add(PlotData.plot("data", adapter, data)); frame.add(DataPlot.plot("data", adapter, data));
return input; return input;
} }

View File

@ -29,7 +29,7 @@ import hep.dataforge.stat.fit.FitManager;
import hep.dataforge.stat.models.ModelManager; import hep.dataforge.stat.models.ModelManager;
import hep.dataforge.stat.models.WeightedXYModel; import hep.dataforge.stat.models.WeightedXYModel;
import hep.dataforge.stat.models.XYModel; import hep.dataforge.stat.models.XYModel;
import hep.dataforge.tables.PointAdapter; import hep.dataforge.tables.ValuesAdapter;
import hep.dataforge.tables.XYAdapter; import hep.dataforge.tables.XYAdapter;
import inr.numass.actions.*; import inr.numass.actions.*;
import inr.numass.data.api.NumassAnalyzer; import inr.numass.data.api.NumassAnalyzer;
@ -294,8 +294,8 @@ public class NumassPlugin extends BasicPlugin {
} }
private XYAdapter getAdapter(Meta an) { private XYAdapter getAdapter(Meta an) {
if (an.hasMeta(PointAdapter.DATA_ADAPTER_KEY)) { if (an.hasMeta(ValuesAdapter.DATA_ADAPTER_KEY)) {
return new XYAdapter(an.getMeta(PointAdapter.DATA_ADAPTER_KEY)); return new XYAdapter(an.getMeta(ValuesAdapter.DATA_ADAPTER_KEY));
} else { } else {
return new XYAdapter(NumassPoint.HV_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_ERROR_KEY); return new XYAdapter(NumassPoint.HV_KEY, NumassAnalyzer.COUNT_RATE_KEY, NumassAnalyzer.COUNT_RATE_ERROR_KEY);
} }

View File

@ -25,8 +25,6 @@ import org.apache.commons.math3.random.JDKRandomGenerator;
import org.apache.commons.math3.random.RandomDataGenerator; import org.apache.commons.math3.random.RandomDataGenerator;
import org.apache.commons.math3.random.RandomGenerator; import org.apache.commons.math3.random.RandomGenerator;
import java.util.Iterator;
import static hep.dataforge.maths.RandomUtils.getDefaultRandomGenerator; import static hep.dataforge.maths.RandomUtils.getDefaultRandomGenerator;
import static java.lang.Double.isNaN; import static java.lang.Double.isNaN;
import static java.lang.Math.sqrt; import static java.lang.Math.sqrt;
@ -68,8 +66,8 @@ public class SpectrumGenerator implements Generator {
@Override @Override
public Table generateData(Iterable<Values> config) { public Table generateData(Iterable<Values> config) {
ListTable.Builder res = new ListTable.Builder(adapter.getFormat()); ListTable.Builder res = new ListTable.Builder(adapter.getFormat());
for (Iterator<Values> it = config.iterator(); it.hasNext();) { for (Values aConfig : config) {
res.row(this.generateDataPoint(it.next())); res.row(this.generateDataPoint(aConfig));
} }
return res.build(); return res.build();
} }
@ -83,8 +81,8 @@ public class SpectrumGenerator implements Generator {
*/ */
public Table generateExactData(Iterable<Values> config) { public Table generateExactData(Iterable<Values> config) {
ListTable.Builder res = new ListTable.Builder(adapter.getFormat()); ListTable.Builder res = new ListTable.Builder(adapter.getFormat());
for (Iterator<Values> it = config.iterator(); it.hasNext();) { for (Values aConfig : config) {
res.row(this.generateExactDataPoint(it.next())); res.row(this.generateExactDataPoint(aConfig));
} }
return res.build(); return res.build();
} }

View File

@ -19,7 +19,7 @@ import hep.dataforge.maths.functions.FunctionCaching;
import hep.dataforge.maths.integration.GaussRuleIntegrator; import hep.dataforge.maths.integration.GaussRuleIntegrator;
import hep.dataforge.maths.integration.UnivariateIntegrator; import hep.dataforge.maths.integration.UnivariateIntegrator;
import hep.dataforge.plots.PlotFrame; import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.data.PlotXYFunction; import hep.dataforge.plots.data.XYFunctionPlot;
import hep.dataforge.utils.Misc; import hep.dataforge.utils.Misc;
import hep.dataforge.values.Values; import hep.dataforge.values.Values;
import org.apache.commons.math3.analysis.BivariateFunction; import org.apache.commons.math3.analysis.BivariateFunction;
@ -180,12 +180,12 @@ public class LossCalculator {
final LossCalculator loss = LossCalculator.instance; final LossCalculator loss = LossCalculator.instance;
final List<Double> probs = loss.getGunLossProbabilities(set.getDouble("X")); final List<Double> probs = loss.getGunLossProbabilities(set.getDouble("X"));
UnivariateFunction single = (double e) -> probs.get(1) * scatterFunction.value(e); UnivariateFunction single = (double e) -> probs.get(1) * scatterFunction.value(e);
frame.add(PlotXYFunction.plotFunction("Single scattering", single::value, 0, 100, 1000)); frame.add(XYFunctionPlot.plotFunction("Single scattering", single::value, 0, 100, 1000));
for (int i = 2; i < probs.size(); i++) { for (int i = 2; i < probs.size(); i++) {
final int j = i; final int j = i;
UnivariateFunction scatter = (double e) -> probs.get(j) * loss.getLossValue(j, e, 0d); UnivariateFunction scatter = (double e) -> probs.get(j) * loss.getLossValue(j, e, 0d);
frame.add(PlotXYFunction.plotFunction(j + " scattering", scatter::value, 0, 100, 1000)); frame.add(XYFunctionPlot.plotFunction(j + " scattering", scatter::value, 0, 100, 1000));
} }
UnivariateFunction total = (eps) -> { UnivariateFunction total = (eps) -> {
@ -199,11 +199,11 @@ public class LossCalculator {
return sum; return sum;
}; };
frame.add(PlotXYFunction.plotFunction("Total loss", total::value, 0, 100, 1000)); frame.add(XYFunctionPlot.plotFunction("Total loss", total::value, 0, 100, 1000));
} else { } else {
frame.add(PlotXYFunction.plotFunction("Differential crosssection", scatterFunction::value, 0, 100, 2000)); frame.add(XYFunctionPlot.plotFunction("Differential crosssection", scatterFunction::value, 0, 100, 2000));
} }
} }

View File

@ -8,7 +8,7 @@ import hep.dataforge.kodex.configure
import hep.dataforge.maths.histogram.UnivariateHistogram import hep.dataforge.maths.histogram.UnivariateHistogram
import hep.dataforge.meta.Laminate import hep.dataforge.meta.Laminate
import hep.dataforge.plots.PlotPlugin import hep.dataforge.plots.PlotPlugin
import hep.dataforge.plots.data.PlotData import hep.dataforge.plots.data.DataPlot
import hep.dataforge.tables.Table import hep.dataforge.tables.Table
import hep.dataforge.tables.ValueMap import hep.dataforge.tables.ValueMap
import hep.dataforge.values.ValueType import hep.dataforge.values.ValueType
@ -75,7 +75,7 @@ class TimeAnalyzedAction : OneToOneAction<NumassPoint, Table>() {
} }
} }
histPlot.add(PlotData(name) histPlot.add(DataPlot(name)
.configure { .configure {
"showLine" to true "showLine" to true
"showSymbol" to false "showSymbol" to false
@ -116,7 +116,7 @@ class TimeAnalyzedAction : OneToOneAction<NumassPoint, Table>() {
} }
pm.getPlotFrame(getName(), "stat-method").add( pm.getPlotFrame(getName(), "stat-method").add(
PlotData(name).configure { DataPlot(name).configure {
"showLine" to true "showLine" to true
"thickness" to 4 "thickness" to 4
"title" to "${name}_${input.voltage}" "title" to "${name}_${input.voltage}"

View File

@ -17,7 +17,7 @@ package inr.numass.models;
import hep.dataforge.maths.integration.GaussRuleIntegrator; import hep.dataforge.maths.integration.GaussRuleIntegrator;
import hep.dataforge.plots.PlotFrame; import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.data.PlotXYFunction; import hep.dataforge.plots.data.XYFunctionPlot;
import inr.numass.NumassPlugin; import inr.numass.NumassPlugin;
import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.UnivariateFunction;
@ -41,8 +41,8 @@ public class TestNeLossParametrisation {
System.out.println(norm); System.out.println(norm);
frame.add(PlotXYFunction.plotFunction("old", x->oldFunction.value(x), 0, 30, 300)); frame.add(XYFunctionPlot.plotFunction("old", x->oldFunction.value(x), 0, 30, 300));
frame.add(PlotXYFunction.plotFunction("new", x->newFunction.value(x), 0, 30, 300)); frame.add(XYFunctionPlot.plotFunction("new", x->newFunction.value(x), 0, 30, 300));
} }
public static UnivariateFunction getSingleScatterFunction( public static UnivariateFunction getSingleScatterFunction(

View File

@ -16,8 +16,8 @@
package inr.numass.models; package inr.numass.models;
import hep.dataforge.context.Global; import hep.dataforge.context.Global;
import hep.dataforge.plots.data.PlotData; import hep.dataforge.plots.data.DataPlot;
import hep.dataforge.plots.data.PlotXYFunction; import hep.dataforge.plots.data.XYFunctionPlot;
import hep.dataforge.plots.jfreechart.JFreeChartFrame; import hep.dataforge.plots.jfreechart.JFreeChartFrame;
import inr.numass.NumassPlugin; import inr.numass.NumassPlugin;
@ -32,8 +32,8 @@ public class TransmissionInterpolatorTest {
//JFreeChartFrame.drawFrame("TransmissionInterpolatorTest", null); //JFreeChartFrame.drawFrame("TransmissionInterpolatorTest", null);
TransmissionInterpolator interpolator = TransmissionInterpolator.fromFile(Global.instance(), TransmissionInterpolator interpolator = TransmissionInterpolator.fromFile(Global.instance(),
"d:\\sterile-new\\loss2014-11\\.dataforge\\merge\\empty_sum.onComplete", "Uset", "CR", 15, 0.8, 19002d); "d:\\sterile-new\\loss2014-11\\.dataforge\\merge\\empty_sum.onComplete", "Uset", "CR", 15, 0.8, 19002d);
frame.add(PlotData.plot("data", interpolator.getX(), interpolator.getY())); frame.add(DataPlot.plot("data", interpolator.getX(), interpolator.getY()));
frame.add(PlotXYFunction.plotFunction("interpolated", interpolator::value, interpolator.getXmin(), interpolator.getXmax(), 2000)); frame.add(XYFunctionPlot.plotFunction("interpolated", interpolator::value, interpolator.getXmin(), interpolator.getXmax(), 2000));
// PrintFunction.printFuntionSimple(new PrintWriter(System.onComplete), interpolator, interpolator.getXmin(), interpolator.getXmax(), 500); // PrintFunction.printFuntionSimple(new PrintWriter(System.onComplete), interpolator, interpolator.getXmin(), interpolator.getXmax(), 500);
} }

View File

@ -8,7 +8,7 @@ import hep.dataforge.kodex.fx.plots.PlotContainer
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaBuilder import hep.dataforge.meta.MetaBuilder
import hep.dataforge.plots.XYPlotFrame import hep.dataforge.plots.XYPlotFrame
import hep.dataforge.plots.data.PlotData import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.data.PlotDataUtils import hep.dataforge.plots.data.PlotDataUtils
import hep.dataforge.plots.data.PlottableGroup import hep.dataforge.plots.data.PlottableGroup
import hep.dataforge.plots.data.TimePlot import hep.dataforge.plots.data.TimePlot
@ -83,7 +83,7 @@ class NumassLoaderView : View() {
private val spectra = HashMap<Double, Table>();//spectra cache private val spectra = HashMap<Double, Table>();//spectra cache
val spectrumData = PlotData("spectrum") val spectrumData = DataPlot("spectrum")
val hvPlotData = PlottableGroup<TimePlot>() val hvPlotData = PlottableGroup<TimePlot>()
//private var points = FXCollections.observableArrayList<NumassPoint>() //private var points = FXCollections.observableArrayList<NumassPoint>()
@ -331,7 +331,7 @@ class NumassLoaderView : View() {
val index = AtomicInteger(0); val index = AtomicInteger(0);
data.points.map { point -> data.points.map { point ->
val seriesName = String.format("%d: %.2f", index.incrementAndGet(), point.voltage) val seriesName = String.format("%d: %.2f", index.incrementAndGet(), point.voltage)
PlotData.plot( DataPlot.plot(
seriesName, seriesName,
XYAdapter(NumassAnalyzer.CHANNEL_KEY, valueAxis), XYAdapter(NumassAnalyzer.CHANNEL_KEY, valueAxis),
NumassDataUtils.spectrumWithBinning(getSpectrum(point), binning) NumassDataUtils.spectrumWithBinning(getSpectrum(point), binning)

View File

@ -5,7 +5,7 @@ import hep.dataforge.kodex.configure
import hep.dataforge.kodex.fx.plots.PlotContainer import hep.dataforge.kodex.fx.plots.PlotContainer
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.plots.Plot import hep.dataforge.plots.Plot
import hep.dataforge.plots.data.PlotData import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.storage.api.PointLoader import hep.dataforge.storage.api.PointLoader
import hep.dataforge.storage.api.ValueIndex import hep.dataforge.storage.api.ValueIndex
@ -36,7 +36,7 @@ class SlowControlView : View("My View") {
ArrayList<Plot>().apply { ArrayList<Plot>().apply {
loader.format.columns.filter { it.name != "timestamp" }.forEach { loader.format.columns.filter { it.name != "timestamp" }.forEach {
val adapter = XYAdapter("timestamp", it.name); val adapter = XYAdapter("timestamp", it.name);
this += PlotData.plot(it.name, adapter, data).configure { this += DataPlot.plot(it.name, adapter, data).configure {
"showLine" to true "showLine" to true
"showSymbol" to false "showSymbol" to false
"showErrors" to false "showErrors" to false

View File

@ -1,7 +1,7 @@
package inr.numass.viewer.test package inr.numass.viewer.test
import hep.dataforge.kodex.fx.plots.PlotContainer import hep.dataforge.kodex.fx.plots.PlotContainer
import hep.dataforge.plots.data.PlotData import hep.dataforge.plots.data.DataPlot
import hep.dataforge.plots.jfreechart.JFreeChartFrame import hep.dataforge.plots.jfreechart.JFreeChartFrame
import hep.dataforge.tables.ValueMap import hep.dataforge.tables.ValueMap
import hep.dataforge.tables.XYAdapter import hep.dataforge.tables.XYAdapter
@ -15,7 +15,7 @@ class JFCTest : View("My View") {
val rnd = Random(); val rnd = Random();
val plot = JFreeChartFrame(); val plot = JFreeChartFrame();
val data = PlotData("data"); val data = DataPlot("data");
val button = button("test") { val button = button("test") {
action { action {