Search in sources :

Example 1 with AxisLinear

use of info.monitorenter.gui.chart.axis.AxisLinear 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);
    }
}
Also used : LabelFormatterDate(info.monitorenter.gui.chart.labelformatters.LabelFormatterDate) Trace2DLtd(info.monitorenter.gui.chart.traces.Trace2DLtd) GridBagConstraints(java.awt.GridBagConstraints) ZoomableChart(info.monitorenter.gui.chart.ZoomableChart) ChartPanel(info.monitorenter.gui.chart.views.ChartPanel) GridBagLayout(java.awt.GridBagLayout) LayoutFactory(info.monitorenter.gui.chart.controls.LayoutFactory) AxisLinear(info.monitorenter.gui.chart.axis.AxisLinear) SimpleDateFormat(java.text.SimpleDateFormat) IAxis(info.monitorenter.gui.chart.IAxis)

Aggregations

IAxis (info.monitorenter.gui.chart.IAxis)1 ZoomableChart (info.monitorenter.gui.chart.ZoomableChart)1 AxisLinear (info.monitorenter.gui.chart.axis.AxisLinear)1 LayoutFactory (info.monitorenter.gui.chart.controls.LayoutFactory)1 LabelFormatterDate (info.monitorenter.gui.chart.labelformatters.LabelFormatterDate)1 Trace2DLtd (info.monitorenter.gui.chart.traces.Trace2DLtd)1 ChartPanel (info.monitorenter.gui.chart.views.ChartPanel)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 SimpleDateFormat (java.text.SimpleDateFormat)1