use of info.monitorenter.gui.chart.views.ChartPanel in project ACS by ACS-Community.
the class PlotWidget method initialize.
/**
* This method initializes this
*
*/
private void initialize() {
if (position == 0) {
LayoutFactory lfct = LayoutFactory.getInstance();
lfct.setShowTraceNameMenu(false);
lfct.setShowPhysicalUnitsMenu(false);
chart = new ZoomableChart();
// Changing X Axis for time presentation
IAxis xAxis = new AxisLinear();
IAxis yAxis = new AxisLinear();
chart.setAxisXBottom((AAxis) xAxis, 0);
chart.setAxisYLeft((AAxis) yAxis, 0);
chart.setGridColor(Color.BLACK);
xAxis.setFormatter((IAxisLabelFormatter) new LabelFormatterDate(new SimpleDateFormat("H:mm:ss")));
xAxis.getAxisTitle().setTitle("Time [seconds]");
yAxis.getAxisTitle().setTitle("Property Value");
traces = new ArrayList<Trace2DLtd>();
chart.setSize(800, 600);
// add the chart to the panel
this.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.CENTER;
gbc.ipadx = 10;
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 1;
gbc.weighty = 1;
ChartPanel cp = new ChartPanel(chart);
this.add(cp, gbc);
// create new trace for the data.
//now are seconds no minutes
Trace2DLtd tempTrace = new Trace2DLtd(timewindow * (int) frequency);
tempTrace.setColor(colors[currentColor]);
currentColor++;
if (currentColor >= colors.length) {
currentColor = 0;
}
//trace.setPhysicalUnits("Ticks", "Voltage");
chart.addTrace(tempTrace);
traces.add(tempTrace);
}
}
Aggregations