[Date Prev][Date Next][Index][Thread] [SGT Mail Archive] [SGT Main Page]

Re: Using Collection for SimpleLine



*************************************************
Message from the sgt mail list.
*************************************************

*************************************************
Message from the sgt mail list.
*************************************************

That plots but still only the last line is visible

In my program I create a plot with
Plot plot = new Plot("Net Activity");
and Add lines to it inside a for loop with
plot.addPlot(x, y, "xTitle", "xUnits", "yTitle", "yUnits", "Legend");


Then I call
plot.finalizeData();

The code for my Plot Class is below.. Can you see what I am doing wrong?


package livetovirtualbridgesim;

import gov.noaa.pmel.sgt.demo.JPointDemo;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;

import gov.noaa.pmel.sgt.dm.SGTData;
import gov.noaa.pmel.sgt.dm.SGTLine;
import gov.noaa.pmel.sgt.dm.SimpleLine;
import gov.noaa.pmel.sgt.dm.SGTMetaData;
import gov.noaa.pmel.sgt.swing.JPlotLayout;

import gov.noaa.pmel.util.Point2D;
import gov.noaa.pmel.util.Range2D;
import gov.noaa.pmel.util.Domain;

public class Plot extends JFrame{
    private JPlotLayout layout;


    public Plot(String title) {

        layout = new JPlotLayout(false, false, false, "DATA",  null, false);
        layout.setBatch(true);
        layout.setTitles(title, "", "");
        layout.setTitleHeightP(0.2, 0.2);

        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(layout, BorderLayout.CENTER);
        pack();
        setVisible(true);

    }

    public void finalizeData()
    {
        layout.setBatch(false);
        layout.draw();

    }

    public void addPlot(double xArray[], double yArray[], String
xLabel,String xUnits, String yLabel, String yUnits , String legend){
        SimpleLine data = new SimpleLine(xArray, yArray, legend);
        SGTMetaData meta = new SGTMetaData(xLabel, xUnits , false, false);
        data.setXMetaData(meta);
        meta = new SGTMetaData(yLabel, yUnits, false, false);
        data.setYMetaData(meta);
        layout.addData((SGTData)data,data.getTitle());
   }


}

> *************************************************
> Message from the sgt mail list.
> *************************************************
>
> Chris,
>
> I think what you need to do is to add each line as a SimpleLine, but via a
> cast.
>
> Something like:
>
> graph.addData((SGTData) simpleLine[i], lineAttribute[i])
>
> I wish someone would clean up this stuttering list server.  It's worse
> than
> a Bush speech at a hurricane relief photo-op.
>
> ubk
>
> K. B. Udaya, Ph.D.
>
> ubk@kogalur-shear.com
>
>
>
>
>
>
> *************************************************
> To remove yourself from this mailing list,
> send mail to <epic-majordomo@noaa.gov> with
> "unsubscribe sgt" in the message body.
> ==========
>



*************************************************
To remove yourself from this mailing list,
send mail to <epic-majordomo@noaa.gov> with
"unsubscribe sgt" in the message body.
==========


*************************************************
To remove yourself from this mailing list,
send mail to <epic-majordomo@noaa.gov> with
"unsubscribe sgt" in the message body.
==========


Privacy Notice, External Links Disclaimer.