/* * Copyright (c) 2014-2017 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.ui.Panel; import ch.psi.utils.State; /** * */ public class Didier extends Panel { //LinePlotErrorSeries seriesEnergy = new LinePlotErrorSeries("Energy"); //LinePlotErrorSeries seriesEnergySpread = new LinePlotErrorSeries("Energy Spread", null, 2); LinePlotSeries seriesEnergy = new LinePlotSeries("Energy"); LinePlotSeries seriesEnergySpread = new LinePlotSeries("Energy Spread", null, 2); public Didier() { initComponents(); //plot.setStyle(LinePlotJFree.Style.ErrorY); plot.addSeries(seriesEnergy); plot.addSeries(seriesEnergySpread); plot.getAxis(Plot.AxisId.X).setLabel("Gun Phase"); plot.getAxis(Plot.AxisId.Y).setLabel("Energy (MeV)"); plot.getAxis(Plot.AxisId.Y2).setLabel("Energy Spread (MeV)"); plot.setLegendVisible(true); double[] x = new double[]{0,1,2,3,4}; double[] y1 = new double[]{0,1,2,3,4}; double[] y2 = new double[]{10,11,12,13,14}; double[] e = new double[]{1,1,1,1,1}; //seriesEnergy.setData(x, y1,e); //seriesEnergySpread.setData(x, y2, e); seriesEnergy.setData(x, y1); seriesEnergySpread.setData(x, y2); } //Overridable callbacks @Override public void onInitialize(int runCount) { } @Override public void onStateChange(State state, State former) { } @Override public void onExecutedFile(String fileName, Object result) { } //Callback to perform update - in event thread @Override protected void doUpdate() { } @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { plot = new ch.psi.pshell.plot.LinePlotJFree(); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(2, 2, 2)) ); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private ch.psi.pshell.plot.LinePlotJFree plot; // End of variables declaration//GEN-END:variables }