From 0f47de485d84830c03d46abf3eeee50a1db26636 Mon Sep 17 00:00:00 2001 From: sfop Date: Tue, 28 Jun 2016 16:52:35 +0200 Subject: [PATCH] Startup --- plugins/GunSolenoidAlignment.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/plugins/GunSolenoidAlignment.java b/plugins/GunSolenoidAlignment.java index c052667..b1a0568 100644 --- a/plugins/GunSolenoidAlignment.java +++ b/plugins/GunSolenoidAlignment.java @@ -2,6 +2,8 @@ * Copyright (c) 2014 Paul Scherrer Institute. All rights reserved. */ +import ch.psi.pshell.plot.LinePlotErrorSeries; +import ch.psi.pshell.plot.LinePlotJFree; import ch.psi.pshell.plot.LinePlotSeries; import ch.psi.pshell.plot.Plot; import ch.psi.pshell.scan.Scan; @@ -27,6 +29,7 @@ public class GunSolenoidAlignment extends Panel { public GunSolenoidAlignment() { initComponents(); + centroidPlot.setStyle(LinePlotJFree.Style.ErrorXY); } boolean running; @@ -34,7 +37,9 @@ public class GunSolenoidAlignment extends Panel { public void onNewRecord(Scan scan, ScanRecord record) { try { if (running) { - scanSeries.appendData((Double) record.getValues()[0], (Double) record.getValues()[1]); + double error_x = 0.2; + double error_y = 0.4; + scanSeries.appendData((Double) record.getValues()[0], (Double) record.getValues()[1], error_x, error_y); progressBar.setValue((int) (1000.0 * record.getIndex() / scan.getNumberOfRecords())); } } catch (Exception ex) { @@ -70,7 +75,7 @@ public class GunSolenoidAlignment extends Panel { protected void doUpdate() { } - LinePlotSeries scanSeries; + LinePlotErrorSeries scanSeries; int index = 1; @@ -80,9 +85,13 @@ public class GunSolenoidAlignment extends Panel { //double[] y =(double[]) Convert.toDouble(sr.getReadable(1)); double[] x = (double[]) Convert.toDouble(hx); double[] y = (double[]) Convert.toDouble(hy); - LinePlotSeries hull = new LinePlotSeries(scanSeries.getName() + "H", scanSeries.getColor()); + LinePlotErrorSeries hull = new LinePlotErrorSeries(scanSeries.getName() + "H", scanSeries.getColor()); centroidPlot.addSeries(hull); - hull.setData((double[]) Convert.toDouble(x), (double[]) Convert.toDouble(y)); + //hull.setData((double[]) Convert.toDouble(x), (double[]) Convert.toDouble(y)); + for (int i=0; i