Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Package Functions | Package Attributes | Private Member Functions | Private Attributes
ptolemy.plot.Histogram Class Reference

A histogram plotter. More...

Inheritance diagram for ptolemy.plot.Histogram:
Inheritance graph
[legend]
Collaboration diagram for ptolemy.plot.Histogram:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void addLegend (int dataset, String legend)
 Add a legend (displayed at the upper right) for the specified data set with the specified string.
synchronized void addPoint (final int dataset, final double value)
 In the specified data set, add the specified value to the histogram.
synchronized void addPoint (int dataset, double x, double y, boolean connected)
 In the specified data set, add the specified y value to the histogram.
synchronized void clear (final boolean format)
 Clear the plot of all data points.
synchronized void exportToPlot (PrintWriter output, String dtd)
 Write plot data information to the specified output stream in PlotML, but in such a way that the Plot class can read it and reproduce the histogram.
synchronized void fillPlot ()
 Rescale so that the data that is currently plotted just fits.
synchronized void samplePlot ()
 Create a sample plot.
synchronized void setBars (double width, double offset)
 Set the width and offset of the bars.
synchronized void setBinOffset (double offset)
 Set the offset of the bins, in whatever units the data are given.
void setBinWidth (double width)
 Set the width of the bins, in whatever units the data are given.
synchronized void write (Writer out, String dtd)
 Write the current data and plot configuration to the specified stream in PlotML syntax.
synchronized void writeData (PrintWriter output)
 Write plot data information to the specified output stream in PlotML.
synchronized void writeFormat (PrintWriter output)
 Write plot format information to the specified output stream.
String ReadPlotApplet ()
synchronized void addXTick (String label, double position)
 Specify a tick mark for the X axis.
synchronized void addYTick (String label, double position)
 Specify a tick mark for the Y axis.
synchronized void clear (boolean axes)
 If the argument is true, clear the axes.
synchronized void clearLegends ()
 Clear all legends.
void deferIfNecessary (Runnable action)
 If this method is called in the event thread, then simply execute the specified action.
synchronized void export (OutputStream out)
 Export a description of the plot.
synchronized BufferedImage exportImage ()
 Create a BufferedImage and draw this plot to it.
synchronized BufferedImage exportImage (Rectangle rectangle)
 Create a BufferedImage the size of the given rectangle and draw this plot to it at the position specified by the rectangle.
synchronized BufferedImage exportImage (BufferedImage bufferedImage, Rectangle rectangle, RenderingHints hints, boolean transparent)
 Draw this plot onto the specified image at the position of the specified rectangle with the size of the specified rectangle.
synchronized BufferedImage exportImage (BufferedImage bufferedImage)
 Draw this plot onto the provided image.
boolean getColor ()
 Return whether the plot uses color.
Color[] getColors ()
 Get the point colors.
String getDataurl ()
 Get the file specification that was given by setDataurl.
URL getDocumentBase ()
 Get the document base that was set by setDocumentBase.
boolean getGrid ()
 Return whether the grid is drawn.
synchronized String getLegend (int dataset)
 Get the legend for a dataset, or null if there is none.
synchronized int getLegendDataset (String legend)
 Given a legend string, return the corresponding dataset or -1 if no legend was added with that legend string The legend would have been set by addLegend().
Rectangle getPlotRectangle ()
 If the size of the plot has been set by setSize(), then return that size.
synchronized Dimension getPreferredSize ()
 Get the preferred size of this component.
synchronized String getTitle ()
 Get the title of the graph, or an empty string if there is none.
synchronized double[] getXAutoRange ()
 Get the range for X values of the data points registered so far.
synchronized String getXLabel ()
 Get the label for the X (horizontal) axis, or null if none has been set.
boolean getXLog ()
 Return whether the X axis is drawn with a logarithmic scale.
synchronized double[] getXRange ()
 Get the X range.
synchronized Vector[] getXTicks ()
 Get the X ticks that have been specified, or null if none.
synchronized double[] getYAutoRange ()
 Get the range for Y values of the data points registered so far.
String getYLabel ()
 Get the label for the Y (vertical) axis, or null if none has been set.
boolean getYLog ()
 Return whether the Y axis is drawn with a logarithmic scale.
synchronized double[] getYRange ()
 Get the Y range.
synchronized Vector[] getYTicks ()
 Get the Y ticks that have been specified, or null if none.
void init ()
 Initialize the component, creating the fill button and parsing an input file, if one has been specified.
synchronized void paintComponent (Graphics graphics)
 Paint the component contents, which in this base class is only the axes.
void parseFile (String filespec)
 Syntactic sugar for parseFile(filespec, documentBase).
synchronized void parseFile (String filespec, URL documentBase)
 Open up the input file, which could be stdin, a URL, or a file.
synchronized int print (Graphics graphics, PageFormat format, int index) throws PrinterException
 Print the plot to a printer, represented by the specified graphics object.
synchronized void read (InputStream in) throws IOException
 Read commands and/or plot data from an input stream in the old (non-XML) file syntax.
synchronized void read (String command)
 Read a single line command provided as a string.
synchronized void removeLegend (int dataset)
 Remove the legend (displayed at the upper right) for the specified data set.
synchronized void renameLegend (int dataset, String newName)
 Rename a legend.
synchronized void resetAxes ()
 Reset the X and Y axes to the ranges that were first specified using setXRange() and setYRange().
synchronized void setBackground (Color background)
 Set the background color.
synchronized void setBounds (int x, int y, int width, int height)
 Move and resize this component.
synchronized void setButtons (boolean visible)
 If the argument is true, make a fill button visible at the upper right.
synchronized void setColor (boolean useColor)
 If the argument is false, draw the plot without using color (in black and white).
synchronized void setColors (Color[] colors)
 Set the point colors.
void setDataurl (String filespec)
 Set the file to read when init() is called.
void setDocumentBase (URL documentBase)
 Set the document base to used when init() is called to read a URL.
synchronized void setForeground (Color foreground)
 Set the foreground color.
synchronized void setGrid (boolean grid)
 Control whether the grid is drawn.
synchronized void setLabelFont (String name)
 Set the label font, which is used for axis labels and legend labels.
synchronized void setPlotRectangle (Rectangle rectangle)
 Set the plot rectangle inside the axes.
synchronized void setSize (int width, int height)
 Set the size of the plot.
synchronized void setTitle (String title)
 Set the title of the graph.
synchronized void setTitleFont (String name)
 Set the title font.
synchronized void setWrap (boolean wrap)
 Specify whether the X axis is wrapped.
synchronized void setXLabel (String label)
 Set the label for the X (horizontal) axis.
synchronized void setXLog (boolean xlog)
 Specify whether the X axis is drawn with a logarithmic scale.
synchronized void setXRange (double min, double max)
 Set the X (horizontal) range of the plot.
synchronized void setYLabel (String label)
 Set the label for the Y (vertical) axis.
synchronized void setYLog (boolean ylog)
 Specify whether the Y axis is drawn with a logarithmic scale.
synchronized void setYRange (double min, double max)
 Set the Y (vertical) range of the plot.
void write (OutputStream out)
 Write the current data and plot configuration to the specified stream in PlotML syntax.
synchronized void write (OutputStream out, String dtd)
 Write the current data and plot configuration to the specified stream in PlotML syntax.
synchronized void writeOldSyntax (OutputStream out)
 Write the current data and plot configuration to the specified stream in the old PtPlot syntax.
synchronized void zoom (double lowx, double lowy, double highx, double highy)
 Zoom in or out to the specified rectangle.

Static Public Member Functions

static Color getColorByName (String name)
 Convert a color name into a Color.

Public Attributes

URL _documentBase = null
 Indicator that size has been set.

Static Public Attributes

static final String PTPLOT_RELEASE = "5.7"

Protected Member Functions

void _checkDatasetIndex (int dataset)
 Check the argument to ensure that it is a valid data set index.
void _drawBar (Graphics graphics, int dataset, long xpos, long ypos, boolean clip)
 Draw bar from the specified point to the y axis.
synchronized void _drawPlot (Graphics graphics, boolean clearfirst)
 Draw the axes and then plot the histogram.
boolean _parseLine (String line)
 Parse a line that gives plotting information.
synchronized void _drawPlot (Graphics graphics, boolean clearfirst, Rectangle drawRect)
 Draw the axes using the current range, label, and title information, at the size of the specified rectangle.
void _drawPoint (Graphics graphics, int dataset, long xpos, long ypos, boolean clip)
 Put a mark corresponding to the specified dataset at the specified x and y position.
void _help ()
 Display basic information in its own window.
void _setButtonsVisibility (boolean vis)
 Set the visibility of the Fill button.
void _setPadding (double padding)
 Set the padding multiple.
void _writeOldSyntax (PrintWriter output)
 Write plot information to the specified output stream in the old PtPlot syntax.

Protected Attributes

int _currentdataset = -1
 The current dataset.
Vector _points = new Vector()
 A vector of datasets.
Vector _histogram = new Vector()
 A vector of histogram data.
transient double _yMax = 0
transient double _yMin = 0
transient double _xMax = 0
transient double _xMin = 0
double _padding = 0.05
 The factor we pad by so that we don't plot points on the axes.
transient boolean _xRangeGiven = false
transient boolean _yRangeGiven = false
transient boolean _rangesGivenByZooming = false
double _xlowgiven
 The given X and Y ranges.
double _xhighgiven
 The given X and Y ranges.
double _ylowgiven
 The given X and Y ranges.
double _yhighgiven
 The given X and Y ranges.
double _xBottom = Double.MAX_VALUE
 The minimum X value registered so for, for auto ranging.
double _xTop = -Double.MAX_VALUE
 The maximum X value registered so for, for auto ranging.
double _yBottom = Double.MAX_VALUE
 The minimum Y value registered so for, for auto ranging.
double _yTop = -Double.MAX_VALUE
 The maximum Y value registered so for, for auto ranging.
boolean _xlog = false
 Whether to draw the axes using a logarithmic scale.
boolean _ylog = false
 Whether to draw the axes using a logarithmic scale.
boolean _grid = true
 Whether to draw a background grid.
boolean _wrap = false
 Whether to wrap the X axis.
double _wrapHigh
 The high range of the X axis for wrapping.
double _wrapLow
 The low range of the X axis for wrapping.
Color _background = Color.white
 Color of the background, settable from HTML.
Color _foreground = Color.black
 Color of the foreground, settable from HTML.
int _topPadding = 10
 Top padding.
int _bottomPadding = 5
 Bottom padding.
int _rightPadding = 10
 Right padding.
int _leftPadding = 10
 Left padding.
int _ulx = 1
 The x value of the upper left corner of the plot rectangle in pixels.
int _uly = 1
 The y value of the upper left corner of the plot rectangle in pixels.
int _lrx = 100
 The x value of the lower right corner of the plot rectangle in pixels.
int _lry = 100
 The y value of the lower right corner of the plot rectangle in pixels.
Rectangle _specifiedPlotRectangle = null
 User specified plot rectangle, null if none specified.
double _yscale = 1.0
 Scaling used for the vertical axis in plotting points.
double _xscale = 1.0
 Scaling used for the horizontal axis in plotting points.
boolean _usecolor = true
 Indicator whether to use _colors.
int _width = 500
 Width and height of component in pixels.
int _height = 300
 Width and height of component in pixels.
int _preferredWidth = 500
 Width and height of component in pixels.
int _preferredHeight = 300
 Width and height of component in pixels.
transient BufferedImage _plotImage = null

Static Protected Attributes

static final double _LOG10SCALE = 1 / Math.log(10)
static Color[] _colors

Package Functions

void _zoom (int x, int y)
void _zoomBox (int x, int y)
void _zoomStart (int x, int y)

Package Attributes

boolean _originalXRangeGiven = false
boolean _originalYRangeGiven = false
double _originalXlow = 0.0
double _originalXhigh = 0.0
double _originalYlow = 0.0
double _originalYhigh = 0.0

Private Member Functions

void _addPoint (int dataset, double value)
void _clear (boolean format)
void _drawPlotPoint (Graphics graphics, int dataset, int bin, int count)
void _fillPlot ()

Private Attributes

double _barwidth = 0.5
 The width of a bar.
double _baroffset = 0.15
 The offset between bars.
double _binWidth = 1.0
 The width of a bin.
double _binOffset = 0.5
 The offset between bins.
boolean _showing = false
 Set by _drawPlot(), and reset by clear().

Detailed Description

A histogram plotter.

The plot can be configured and data can be provided either through a file with commands or through direct invocation of the public methods of the class. To read a file or a URL, use the read() method.

When calling the public methods, in most cases the changes will not be visible until paint() has been called. To request that this be done, call repaint(). One exception is addPoint(), which makes the affect of the new point visible immediately (or nearly immediately) if the plot is visible on the screen.

The ASCII format for the file file contains any number commands, one per line. Unrecognized commands and commands with syntax errors are ignored. Comments are denoted by a line starting with a pound sign "#". The recognized commands include those supported by the base class, plus a few more. The commands are case insensitive, but are usually capitalized. The number of data sets to be plotted does not need to be specified. Data sets are added as needed. Each dataset is identified with a color (see the base class).

The appearance of the histogram can be altered by the following commands:

 Bars: width
 Bars: width, offset
 

The width is a real number specifying the width of the bars as a fraction of the bin width. It usually has a value less than or equal to one, and defaults to 0.5. The offset is a real number specifying how much the bar of the i th data set is offset from the previous one. This allows bars to "peek out" from behind the ones in front. It defaults to 0.15. Note that the frontmost data set will be the first one.

The width of each bin of the histogram can be specified using:

 BinWidth: width
 

This is given in whatever units the data has. By default, each bin is centered at x = nw, where w is the width of the bin and n is an integer. That bin represents values in the range (x - w/2, x + w/2). The alignment of the bins can be changed with the following command:

 BinOffset: offset
 

If this method is used with argument o, then each bin is centered at x = nw + o, and represents values in the range (x - w/2 + o, x + w/2 + o). So for example, if o = w/2, then each bin represents values from nw to (n + 1)w for some integer n. The default offset is 0.5, half the default bin width.

To specify data to be plotted, start a data set with the following command:

 DataSet: string
 

Here, string is a label that will appear in the legend. It is not necessary to enclose the string in quotation marks. To start a new dataset without giving it a name, use:

 DataSet:
 

In this case, no item will appear in the legend. New datasets are plotted behind the previous ones. The data itself is given by a sequence of numbers, one per line. The numbers are specified as strings that can be parsed by the Double parser in Java. It is also possible to specify the numbers using all the formats accepted by the Plot class, so that the same data may be plotted by both classes. The x data is ignored, and only the y data is used to calculate the histogram.

Author:
Edward A. Lee
Version:
Id:
Histogram.java,v 1.50 2007/12/06 18:23:52 cxh Exp
Since:
Ptolemy II 0.3 .ProposedRating Yellow (cxh) .AcceptedRating Yellow (cxh)

Definition at line 122 of file Histogram.java.


Member Function Documentation

void ptolemy.plot.Histogram._addPoint ( int  dataset,
double  value 
) [inline, private]

Definition at line 698 of file Histogram.java.

                                                      {
        // Ensure replot of offscreen buffer.
        _plotImage = null;

        _checkDatasetIndex(dataset);

        // Calculate the bin number.
        int bin = (int) (Math.round((value - _binOffset) / _binWidth));
        Integer binobj = Integer.valueOf(bin);

        // Add to the appropriate bin
        Hashtable bins = (Hashtable) _histogram.elementAt(dataset);
        int count;

        if (bins.containsKey(binobj)) {
            // increase the count
            count = 1 + ((Integer) bins.get(binobj)).intValue();
            bins.put(binobj, Integer.valueOf(count));
        } else {
            // start a new entry.
            count = 1;
            bins.put(binobj, Integer.valueOf(count));
        }

        // For auto-ranging, keep track of min and max.
        double x = (bin * _binWidth) + _binOffset;

        if (x < _xBottom) {
            _xBottom = x;
        }

        double xtop = x + (_binWidth / 2.0);

        if (xtop > _xTop) {
            _xTop = xtop;
        }

        if (count > _yTop) {
            _yTop = count;
        }

        _yBottom = 0.0;

        Vector pts = (Vector) _points.elementAt(dataset);
        pts.addElement(Double.valueOf(value));

        // Draw the point on the screen only if the plot is showing.
        // Need to check that graphics is not null because plot may have
        // been dismissed.
        Graphics graphics = getGraphics();

        if (_showing && (graphics != null)) {
            // In swing, updates to showing graphics must be done in the
            // event thread, not here.  Thus, we have to queue the request.
            final int pendingDataset = dataset;
            final int pendingBin = bin;
            final int pendingCount = count;

            // We are in the event thread, so this is safe...
            _drawPlotPoint(graphics, pendingDataset, pendingBin, pendingCount);
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void ptolemy.plot.Histogram._checkDatasetIndex ( int  dataset) [inline, protected]

Check the argument to ensure that it is a valid data set index.

If it is less than zero, throw an IllegalArgumentException (which is a runtime exception). If it does not refer to an existing data set, then fill out the _points and _histogram Vectors so that they refer to all existing data sets.

Parameters:
datasetThe data set index.

Definition at line 421 of file Histogram.java.

                                                   {
        if (dataset < 0) {
            throw new IllegalArgumentException(
                    "Plot._checkDatasetIndex: Cannot"
                            + " give a negative number for the data set index.");
        }

        while (dataset >= _points.size()) {
            _points.addElement(new Vector());
            _histogram.addElement(new Hashtable());
        }
    }

Here is the caller graph for this function:

void ptolemy.plot.Histogram._clear ( boolean  format) [inline, private]

Definition at line 768 of file Histogram.java.

                                        {
        // Ensure replot of offscreen buffer.
        _plotImage = null;

        super.clear(format);
        _currentdataset = -1;
        _points = new Vector();
        _histogram = new Vector();
        _showing = false;

        if (format) {
            // Reset format controls
            _barwidth = 0.5;
            _baroffset = 0.15;
            _binWidth = 1.0;
            _binOffset = 0.5;
        }
    }

Here is the caller graph for this function:

void ptolemy.plot.Histogram._drawBar ( Graphics  graphics,
int  dataset,
long  xpos,
long  ypos,
boolean  clip 
) [inline, protected]

Draw bar from the specified point to the y axis.

If the specified point is below the y axis or outside the x range, do nothing. If the clip argument is true, then do not draw above the y range. Note that paint() should be called before calling this method so that _xscale and _yscale are properly set.

Parameters:
graphicsThe graphics context.
datasetThe index of the dataset.
xposThe x position.
yposThe y position.
clipIf true, then do not draw outside the range.

Definition at line 446 of file Histogram.java.

                                     {
        if (clip) {
            if (ypos < _uly) {
                ypos = _uly;
            }

            if (ypos > _lry) {
                ypos = _lry;
            }
        }

        if ((ypos <= _lry) && (xpos <= _lrx) && (xpos >= _ulx)) {
            // left x position of bar.
            int barlx = (int) (xpos - ((_barwidth * _binWidth * _xscale) / 2) + (dataset
                    * _baroffset * _binWidth * _xscale));

            // right x position of bar
            int barrx = (int) (barlx + (_barwidth * _binWidth * _xscale));

            if (barlx < _ulx) {
                barlx = _ulx;
            }

            if (barrx > _lrx) {
                barrx = _lrx;
            }

            // Make sure that a bar is always at least one pixel wide.
            if (barlx >= barrx) {
                barrx = barlx + 1;
            }

            // The y position of the zero line.
            long zeroypos = _lry - (long) ((0 - _yMin) * _yscale);

            if (_lry < zeroypos) {
                zeroypos = _lry;
            }

            if (_uly > zeroypos) {
                zeroypos = _uly;
            }

            if ((_yMin >= 0) || (ypos <= zeroypos)) {
                graphics.fillRect(barlx, (int) ypos, barrx - barlx,
                        (int) (zeroypos - ypos));
            } else {
                graphics.fillRect(barlx, (int) zeroypos, barrx - barlx,
                        (int) (ypos - zeroypos));
            }
        }
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.Histogram._drawPlot ( Graphics  graphics,
boolean  clearfirst 
) [inline, protected]

Draw the axes and then plot the histogram.

If the second argument is true, clear the display first. This method is called by paint(). To cause it to be called you would normally call repaint(), which eventually causes paint() to be called.

Note that this is synchronized so that points are not added by other threads while the drawing is occurring. This method should be called only from the event dispatch thread, consistent with swing policy.

Parameters:
graphicsThe graphics context.
clearfirstIf true, clear the plot before proceeding.

Reimplemented from ptolemy.plot.PlotBox.

Definition at line 513 of file Histogram.java.

                                                                                 {
        // We must call PlotBox._drawPlot() before calling _drawPlotPoint
        // so that _xscale and _yscale are set.
        super._drawPlot(graphics, clearfirst);

        _showing = true;

        // Plot the histograms in reverse order so that the first colors
        // appear on top.
        for (int dataset = _points.size() - 1; dataset >= 0; dataset--) {
            Hashtable data = (Hashtable) _histogram.elementAt(dataset);
            Enumeration keys = data.keys();

            while (keys.hasMoreElements()) {
                Integer bin = (Integer) keys.nextElement();
                Integer count = (Integer) data.get(bin);
                _drawPlotPoint(graphics, dataset, bin.intValue(), count
                        .intValue());
            }
        }
    }

Here is the call graph for this function:

synchronized void ptolemy.plot.PlotBox._drawPlot ( Graphics  graphics,
boolean  clearfirst,
Rectangle  drawRect 
) [inline, protected, inherited]

Draw the axes using the current range, label, and title information, at the size of the specified rectangle.

If the second argument is true, clear the display before redrawing. This method is called by paintComponent(). To cause it to be called you would normally call repaint(), which eventually causes paintComponent() to be called.

Note that this is synchronized so that points are not added by other threads while the drawing is occurring. This method should be called only from the event dispatch thread, consistent with swing policy.

Parameters:
graphicsThe graphics context.
clearfirstIf true, clear the plot before proceeding.
drawRectA specification of the size.

Reimplemented in ptolemy.plot.Plot.

Definition at line 1834 of file PlotBox.java.

                                                    {
        // Ignore if there is no graphics object to draw on.
        if (graphics == null) {
            return;
        }

        graphics.setPaintMode();

        /* NOTE: The following seems to be unnecessary with Swing...
         if (clearfirst) {
         // NOTE: calling clearRect() here permits the background
         // color to show through, but it messes up printing.
         // Printing results in black-on-black title and axis labels.
         graphics.setColor(_background);
         graphics.drawRect(0, 0, drawRect.width, drawRect.height);
         graphics.setColor(Color.black);
         }
         */

        // If an error message has been set, display it and return.
        if (_errorMsg != null) {
            int fheight = _labelFontMetrics.getHeight() + 2;
            int msgy = fheight;
            graphics.setColor(Color.black);

            for (int i = 0; i < _errorMsg.length; i++) {
                graphics.drawString(_errorMsg[i], 10, msgy);
                msgy += fheight;
                System.err.println(_errorMsg[i]);
            }

            return;
        }

        // Make sure we have an x and y range
        if (!_xRangeGiven) {
            if (_xBottom > _xTop) {
                // have nothing to go on.
                _setXRange(0, 0);
            } else {
                _setXRange(_xBottom, _xTop);
            }
        }

        if (!_yRangeGiven) {
            if (_yBottom > _yTop) {
                // have nothing to go on.
                _setYRange(0, 0);
            } else {
                _setYRange(_yBottom, _yTop);
            }
        }

        // If user specified a plot rectangle, compute
        // a working plot rectangle which lies inside the
        // drawRect at the user specified coordinates
        Rectangle workingPlotRectangle = null;

        if (_specifiedPlotRectangle != null) {
            workingPlotRectangle = new Rectangle(Math.max(0,
                    _specifiedPlotRectangle.x), Math.max(0,
                    _specifiedPlotRectangle.y), Math.min(drawRect.width,
                    _specifiedPlotRectangle.width), Math.min(drawRect.height,
                    _specifiedPlotRectangle.height));
        }

        // Vertical space for title, if appropriate.
        // NOTE: We assume a one-line title.
        int titley = 0;
        int titlefontheight = _titleFontMetrics.getHeight();

        if (_title == null) {
            // NOTE: If the _title is null, then set it to the empty
            // string to solve the problem where the fill button overlaps
            // the legend if there is no title.  The fix here would
            // be to modify the legend printing text so that it takes
            // into account the case where there is no title by offsetting
            // just enough for the button.
            _title = "";
        }

        if ((_title != null) || (_yExp != 0)) {
            titley = titlefontheight + _topPadding;
        }

        // Number of vertical tick marks depends on the height of the font
        // for labeling ticks and the height of the window.
        Font previousFont = graphics.getFont();
        graphics.setFont(_labelFont);
        graphics.setColor(_foreground); // foreground color not set here  --Rob.

        int labelheight = _labelFontMetrics.getHeight();
        int halflabelheight = labelheight / 2;

        // Draw scaling annotation for x axis.
        // NOTE: 5 pixel padding on bottom.
        int ySPos = drawRect.height - 5;
        int xSPos = drawRect.width - _rightPadding;

        if (_xlog) {
            _xExp = (int) Math.floor(_xtickMin);
        }

        if ((_xExp != 0) && (_xticks == null)) {
            String superscript = Integer.toString(_xExp);
            xSPos -= _superscriptFontMetrics.stringWidth(superscript);
            graphics.setFont(_superscriptFont);

            if (!_xlog) {
                graphics
                        .drawString(superscript, xSPos, ySPos - halflabelheight);
                xSPos -= _labelFontMetrics.stringWidth("x10");
                graphics.setFont(_labelFont);
                graphics.drawString("x10", xSPos, ySPos);
            }

            // NOTE: 5 pixel padding on bottom
            _bottomPadding = ((3 * labelheight) / 2) + 5;
        }

        // NOTE: 5 pixel padding on the bottom.
        if ((_xlabel != null) && (_bottomPadding < (labelheight + 5))) {
            _bottomPadding = labelheight + 5;
        }

        // Compute the space needed around the plot, starting with vertical.
        // NOTE: padding of 5 pixels below title.
        if (workingPlotRectangle != null) {
            _uly = workingPlotRectangle.y;
        } else {
            _uly = titley + 5;
        }

        // NOTE: 3 pixels above bottom labels.
        if (workingPlotRectangle != null) {
            _lry = workingPlotRectangle.y + workingPlotRectangle.height;
        } else {
            _lry = drawRect.height - labelheight - _bottomPadding - 3;
        }

        int height = _lry - _uly;
        _yscale = height / (_yMax - _yMin);
        _ytickscale = height / (_ytickMax - _ytickMin);

        // Number of y tick marks.
        // NOTE: subjective spacing factor.
        int ny = 2 + (height / (labelheight + 10));

        // Compute y increment.
        double yStep = _roundUp((_ytickMax - _ytickMin) / ny);

        // Compute y starting point so it is a multiple of yStep.
        double yStart = yStep * Math.ceil(_ytickMin / yStep);

        // NOTE: Following disables first tick.  Not a good idea?
        // if (yStart == _ytickMin) yStart += yStep;
        // Define the strings that will label the y axis.
        // Meanwhile, find the width of the widest label.
        // The labels are quantized so that they don't have excess resolution.
        int widesty = 0;

        // These do not get used unless ticks are automatic, but the
        // compiler is not smart enough to allow us to reference them
        // in two distinct conditional clauses unless they are
        // allocated outside the clauses.
        String[] ylabels = new String[ny];
        int[] ylabwidth = new int[ny];

        int ind = 0;

        if (_yticks == null) {
            Vector ygrid = null;

            if (_ylog) {
                ygrid = _gridInit(yStart, yStep, true, null);
            }

            // automatic ticks
            // First, figure out how many digits after the decimal point
            // will be used.
            int numfracdigits = _numFracDigits(yStep);

            // NOTE: Test cases kept in case they are needed again.
            // System.out.println("0.1 with 3 digits: " + _formatNum(0.1, 3));
            // System.out.println("0.0995 with 3 digits: " +
            //                    _formatNum(0.0995, 3));
            // System.out.println("0.9995 with 3 digits: " +
            //                    _formatNum(0.9995, 3));
            // System.out.println("1.9995 with 0 digits: " +
            //                    _formatNum(1.9995, 0));
            // System.out.println("1 with 3 digits: " + _formatNum(1, 3));
            // System.out.println("10 with 0 digits: " + _formatNum(10, 0));
            // System.out.println("997 with 3 digits: " + _formatNum(997, 3));
            // System.out.println("0.005 needs: " + _numFracDigits(0.005));
            // System.out.println("1 needs: " + _numFracDigits(1));
            // System.out.println("999 needs: " + _numFracDigits(999));
            // System.out.println("999.0001 needs: "+_numFracDigits(999.0001));
            // System.out.println("0.005 integer digits: " +
            //                    _numIntDigits(0.005));
            // System.out.println("1 integer digits: " + _numIntDigits(1));
            // System.out.println("999 integer digits: " + _numIntDigits(999));
            // System.out.println("-999.0001 integer digits: " +
            //                    _numIntDigits(999.0001));
            double yTmpStart = yStart;

            if (_ylog) {
                yTmpStart = _gridStep(ygrid, yStart, yStep, _ylog);
            }

            for (double ypos = yTmpStart; ypos <= _ytickMax; ypos = _gridStep(
                    ygrid, ypos, yStep, _ylog)) {
                // Prevent out of bounds exceptions
                if (ind >= ny) {
                    break;
                }

                String yticklabel;

                if (_ylog) {
                    yticklabel = _formatLogNum(ypos, numfracdigits);
                } else {
                    yticklabel = _formatNum(ypos, numfracdigits);
                }

                ylabels[ind] = yticklabel;

                int lw = _labelFontMetrics.stringWidth(yticklabel);
                ylabwidth[ind++] = lw;

                if (lw > widesty) {
                    widesty = lw;
                }
            }
        } else {
            // explicitly specified ticks
            Enumeration nl = _yticklabels.elements();

            while (nl.hasMoreElements()) {
                String label = (String) nl.nextElement();
                int lw = _labelFontMetrics.stringWidth(label);

                if (lw > widesty) {
                    widesty = lw;
                }
            }
        }

        // Next we do the horizontal spacing.
        if (workingPlotRectangle != null) {
            _ulx = workingPlotRectangle.x;
        } else {
            if (_ylabel != null) {
                _ulx = widesty + _labelFontMetrics.stringWidth("W")
                        + _leftPadding;
            } else {
                _ulx = widesty + _leftPadding;
            }
        }

        int legendwidth = _drawLegend(graphics, drawRect.width - _rightPadding,
                _uly);

        if (workingPlotRectangle != null) {
            _lrx = workingPlotRectangle.x + workingPlotRectangle.width;
        } else {
            _lrx = drawRect.width - legendwidth - _rightPadding;
        }

        int width = _lrx - _ulx;
        _xscale = width / (_xMax - _xMin);

        _xtickscale = width / (_xtickMax - _xtickMin);

        // Background for the plotting rectangle.
        // Always use a white background because the dataset colors
        // were designed for a white background.
        graphics.setColor(Color.white);
        graphics.fillRect(_ulx, _uly, width, height);

        graphics.setColor(_foreground);
        graphics.drawRect(_ulx, _uly, width, height);

        // NOTE: subjective tick length.
        int tickLength = 5;
        int xCoord1 = _ulx + tickLength;
        int xCoord2 = _lrx - tickLength;

        if (_yticks == null) {
            // auto-ticks
            Vector ygrid = null;
            double yTmpStart = yStart;

            if (_ylog) {
                ygrid = _gridInit(yStart, yStep, true, null);
                yTmpStart = _gridStep(ygrid, yStart, yStep, _ylog);
                ny = ind;
            }

            ind = 0;

            // Set to false if we don't need the exponent
            boolean needExponent = _ylog;

            for (double ypos = yTmpStart; ypos <= _ytickMax; ypos = _gridStep(
                    ygrid, ypos, yStep, _ylog)) {
                // Prevent out of bounds exceptions
                if (ind >= ny) {
                    break;
                }

                int yCoord1 = _lry - (int) ((ypos - _ytickMin) * _ytickscale);

                // The lowest label is shifted up slightly to avoid
                // colliding with x labels.
                int offset = 0;

                if ((ind > 0) && !_ylog) {
                    offset = halflabelheight;
                }

                graphics.drawLine(_ulx, yCoord1, xCoord1, yCoord1);
                graphics.drawLine(_lrx, yCoord1, xCoord2, yCoord1);

                if (_grid && (yCoord1 != _uly) && (yCoord1 != _lry)) {
                    graphics.setColor(Color.lightGray);
                    graphics.drawLine(xCoord1, yCoord1, xCoord2, yCoord1);
                    graphics.setColor(_foreground);
                }

                // Check to see if any of the labels printed contain
                // the exponent.  If we don't see an exponent, then print it.
                if (_ylog && (ylabels[ind].indexOf('e') != -1)) {
                    needExponent = false;
                }

                // NOTE: 4 pixel spacing between axis and labels.
                graphics.drawString(ylabels[ind], _ulx - ylabwidth[ind++] - 4,
                        yCoord1 + offset);
            }

            if (_ylog) {
                // Draw in grid lines that don't have labels.
                Vector unlabeledgrid = _gridInit(yStart, yStep, false, ygrid);

                if (unlabeledgrid.size() > 0) {
                    // If the step is greater than 1, clamp it to 1 so that
                    // we draw the unlabeled grid lines for each
                    //integer interval.
                    double tmpStep = (yStep > 1.0) ? 1.0 : yStep;

                    for (double ypos = _gridStep(unlabeledgrid, yStart,
                            tmpStep, _ylog); ypos <= _ytickMax; ypos = _gridStep(
                            unlabeledgrid, ypos, tmpStep, _ylog)) {
                        int yCoord1 = _lry
                                - (int) ((ypos - _ytickMin) * _ytickscale);

                        if (_grid && (yCoord1 != _uly) && (yCoord1 != _lry)) {
                            graphics.setColor(Color.lightGray);
                            graphics.drawLine(_ulx + 1, yCoord1, _lrx - 1,
                                    yCoord1);
                            graphics.setColor(_foreground);
                        }
                    }
                }

                if (needExponent) {
                    // We zoomed in, so we need the exponent
                    _yExp = (int) Math.floor(yTmpStart);
                } else {
                    _yExp = 0;
                }
            }

            // Draw scaling annotation for y axis.
            if (_yExp != 0) {
                graphics.drawString("x10", 2, titley);
                graphics.setFont(_superscriptFont);
                graphics.drawString(Integer.toString(_yExp), _labelFontMetrics
                        .stringWidth("x10") + 2, titley - halflabelheight);
                graphics.setFont(_labelFont);
            }
        } else {
            // ticks have been explicitly specified
            Enumeration nt = _yticks.elements();
            Enumeration nl = _yticklabels.elements();

            while (nl.hasMoreElements()) {
                String label = (String) nl.nextElement();
                double ypos = ((Double) (nt.nextElement())).doubleValue();

                if ((ypos > _yMax) || (ypos < _yMin)) {
                    continue;
                }

                int yCoord1 = _lry - (int) ((ypos - _yMin) * _yscale);
                int offset = 0;

                if (ypos < (_lry - labelheight)) {
                    offset = halflabelheight;
                }

                graphics.drawLine(_ulx, yCoord1, xCoord1, yCoord1);
                graphics.drawLine(_lrx, yCoord1, xCoord2, yCoord1);

                if (_grid && (yCoord1 != _uly) && (yCoord1 != _lry)) {
                    graphics.setColor(Color.lightGray);
                    graphics.drawLine(xCoord1, yCoord1, xCoord2, yCoord1);
                    graphics.setColor(_foreground);
                }

                // NOTE: 3 pixel spacing between axis and labels.
                graphics.drawString(label, _ulx
                        - _labelFontMetrics.stringWidth(label) - 3, yCoord1
                        + offset);
            }
        }

        int yCoord1 = _uly + tickLength;
        int yCoord2 = _lry - tickLength;
        int charwidth = _labelFontMetrics.stringWidth("8");

        if (_xticks == null) {
            // auto-ticks
            // Number of x tick marks.
            // Need to start with a guess and converge on a solution here.
            int nx = 10;
            double xStep = 0.0;
            int numfracdigits = 0;

            if (_xlog) {
                // X axes log labels will be at most 6 chars: -1E-02
                nx = 2 + (width / ((charwidth * 6) + 10));
            } else {
                // Limit to 10 iterations
                int count = 0;

                while (count++ <= 10) {
                    xStep = _roundUp((_xtickMax - _xtickMin) / nx);

                    // Compute the width of a label for this xStep
                    numfracdigits = _numFracDigits(xStep);

                    // Number of integer digits is the maximum of two endpoints
                    int intdigits = _numIntDigits(_xtickMax);
                    int inttemp = _numIntDigits(_xtickMin);

                    if (intdigits < inttemp) {
                        intdigits = inttemp;
                    }

                    // Allow two extra digits (decimal point and sign).
                    int maxlabelwidth = charwidth
                            * (numfracdigits + 2 + intdigits);

                    // Compute new estimate of number of ticks.
                    int savenx = nx;

                    // NOTE: 10 additional pixels between labels.
                    // NOTE: Try to ensure at least two tick marks.
                    nx = 2 + (width / (maxlabelwidth + 10));

                    if (((nx - savenx) <= 1) || ((savenx - nx) <= 1)) {
                        break;
                    }
                }
            }

            xStep = _roundUp((_xtickMax - _xtickMin) / nx);
            numfracdigits = _numFracDigits(xStep);

            // Compute x starting point so it is a multiple of xStep.
            double xStart = xStep * Math.ceil(_xtickMin / xStep);

            // NOTE: Following disables first tick.  Not a good idea?
            // if (xStart == _xMin) xStart += xStep;
            Vector xgrid = null;
            double xTmpStart = xStart;

            if (_xlog) {
                xgrid = _gridInit(xStart, xStep, true, null);

                //xgrid = _gridInit(xStart, xStep);
                xTmpStart = _gridRoundUp(xgrid, xStart);
            }

            // Set to false if we don't need the exponent
            boolean needExponent = _xlog;

            // Label the x axis.  The labels are quantized so that
            // they don't have excess resolution.
            for (double xpos = xTmpStart; xpos <= _xtickMax; xpos = _gridStep(
                    xgrid, xpos, xStep, _xlog)) {
                String xticklabel;

                if (_xlog) {
                    xticklabel = _formatLogNum(xpos, numfracdigits);

                    if (xticklabel.indexOf('e') != -1) {
                        needExponent = false;
                    }
                } else {
                    xticklabel = _formatNum(xpos, numfracdigits);
                }

                xCoord1 = _ulx + (int) ((xpos - _xtickMin) * _xtickscale);
                graphics.drawLine(xCoord1, _uly, xCoord1, yCoord1);
                graphics.drawLine(xCoord1, _lry, xCoord1, yCoord2);

                if (_grid && (xCoord1 != _ulx) && (xCoord1 != _lrx)) {
                    graphics.setColor(Color.lightGray);
                    graphics.drawLine(xCoord1, yCoord1, xCoord1, yCoord2);
                    graphics.setColor(_foreground);
                }

                int labxpos = xCoord1
                        - (_labelFontMetrics.stringWidth(xticklabel) / 2);

                // NOTE: 3 pixel spacing between axis and labels.
                graphics
                        .drawString(xticklabel, labxpos, _lry + 3 + labelheight);
            }

            if (_xlog) {
                // Draw in grid lines that don't have labels.
                // If the step is greater than 1, clamp it to 1 so that
                // we draw the unlabeled grid lines for each
                // integer interval.
                double tmpStep = (xStep > 1.0) ? 1.0 : xStep;

                // Recalculate the start using the new step.
                xTmpStart = tmpStep * Math.ceil(_xtickMin / tmpStep);

                Vector unlabeledgrid = _gridInit(xTmpStart, tmpStep, false,
                        xgrid);

                if (unlabeledgrid.size() > 0) {
                    for (double xpos = _gridStep(unlabeledgrid, xTmpStart,
                            tmpStep, _xlog); xpos <= _xtickMax; xpos = _gridStep(
                            unlabeledgrid, xpos, tmpStep, _xlog)) {
                        xCoord1 = _ulx
                                + (int) ((xpos - _xtickMin) * _xtickscale);

                        if (_grid && (xCoord1 != _ulx) && (xCoord1 != _lrx)) {
                            graphics.setColor(Color.lightGray);
                            graphics.drawLine(xCoord1, _uly + 1, xCoord1,
                                    _lry - 1);
                            graphics.setColor(_foreground);
                        }
                    }
                }

                if (needExponent) {
                    _xExp = (int) Math.floor(xTmpStart);
                    graphics.setFont(_superscriptFont);
                    graphics.drawString(Integer.toString(_xExp), xSPos, ySPos
                            - halflabelheight);
                    xSPos -= _labelFontMetrics.stringWidth("x10");
                    graphics.setFont(_labelFont);
                    graphics.drawString("x10", xSPos, ySPos);
                } else {
                    _xExp = 0;
                }
            }
        } else {
            // ticks have been explicitly specified
            Enumeration nt = _xticks.elements();
            Enumeration nl = _xticklabels.elements();

            // Code contributed by Jun Wu (jwu@inin.com.au)
            double preLength = 0.0;

            while (nl.hasMoreElements()) {
                String label = (String) nl.nextElement();
                double xpos = ((Double) (nt.nextElement())).doubleValue();

                // If xpos is out of range, ignore.
                if ((xpos > _xMax) || (xpos < _xMin)) {
                    continue;
                }

                // Find the center position of the label.
                xCoord1 = _ulx + (int) ((xpos - _xMin) * _xscale);

                // Find  the start position of x label.
                int labxpos = xCoord1
                        - (_labelFontMetrics.stringWidth(label) / 2);

                // If the labels are not overlapped, proceed.
                if (labxpos > preLength) {
                    // calculate the length of the label
                    preLength = xCoord1
                            + (_labelFontMetrics.stringWidth(label) / 2) + 10;

                    // Draw the label.
                    // NOTE: 3 pixel spacing between axis and labels.
                    graphics.drawString(label, labxpos, _lry + 3 + labelheight);

                    // Draw the label mark on the axis
                    graphics.drawLine(xCoord1, _uly, xCoord1, yCoord1);
                    graphics.drawLine(xCoord1, _lry, xCoord1, yCoord2);

                    // Draw the grid line
                    if (_grid && (xCoord1 != _ulx) && (xCoord1 != _lrx)) {
                        graphics.setColor(Color.lightGray);
                        graphics.drawLine(xCoord1, yCoord1, xCoord1, yCoord2);
                        graphics.setColor(_foreground);
                    }
                }
            }
        }

        // Center the title and X label over the plotting region, not
        // the window.
        graphics.setColor(_foreground);

        if (_title != null) {
            graphics.setFont(_titleFont);

            int titlex = _ulx
                    + ((width - _titleFontMetrics.stringWidth(_title)) / 2);
            graphics.drawString(_title, titlex, titley);
        }

        graphics.setFont(_labelFont);

        if (_xlabel != null) {
            int labelx = _ulx
                    + ((width - _labelFontMetrics.stringWidth(_xlabel)) / 2);
            graphics.drawString(_xlabel, labelx, ySPos);
        }

        int charcenter = 2 + (_labelFontMetrics.stringWidth("W") / 2);

        if (_ylabel != null) {
            int yl = _ylabel.length();

            if (graphics instanceof Graphics2D) {
                int starty = (_uly + ((_lry - _uly) / 2) + (_labelFontMetrics
                        .stringWidth(_ylabel) / 2))
                        - charwidth;
                Graphics2D g2d = (Graphics2D) graphics;

                // NOTE: Fudge factor so label doesn't touch axis labels.
                int startx = (charcenter + halflabelheight) - 2;
                g2d.rotate(Math.toRadians(-90), startx, starty);
                g2d.drawString(_ylabel, startx, starty);
                g2d.rotate(Math.toRadians(90), startx, starty);
            } else {
                // Not graphics 2D, no support for rotation.
                // Vertical label is fairly complex to draw.
                int starty = (_uly + ((_lry - _uly) / 2))
                        - (yl * halflabelheight) + labelheight;

                for (int i = 0; i < yl; i++) {
                    String nchar = _ylabel.substring(i, i + 1);
                    int cwidth = _labelFontMetrics.stringWidth(nchar);
                    graphics.drawString(nchar, charcenter - (cwidth / 2),
                            starty);
                    starty += labelheight;
                }
            }
        }

        graphics.setFont(previousFont);
    }

Here is the call graph for this function:

void ptolemy.plot.Histogram._drawPlotPoint ( Graphics  graphics,
int  dataset,
int  bin,
int  count 
) [inline, private]

Definition at line 797 of file Histogram.java.

                       {
        // Set the color
        if (_usecolor) {
            int color = dataset % _colors.length;
            graphics.setColor(_colors[color]);
        } else {
            graphics.setColor(_foreground);
        }

        double y = count;
        double x = (_binWidth * bin) + _binOffset;

        if (_xlog) {
            if (x <= 0.0) {
                System.err.println("Can't plot non-positive X values "
                        + "when the logarithmic X axis value is specified: "
                        + x);
                return;
            }

            x = Math.log(x) * _LOG10SCALE;
        }

        if (_ylog) {
            if (y <= 0.0) {
                System.err.println("Can't plot non-positive Y values "
                        + "when the logarithmic Y axis value is specified: "
                        + y);
                return;
            }

            y = Math.log(y) * _LOG10SCALE;
        }

        // Use long here because these numbers can be quite large
        // (when we are zoomed out a lot).
        long ypos = _lry - (long) ((y - _yMin) * _yscale);
        long xpos = _ulx + (long) ((x - _xMin) * _xscale);

        _drawBar(graphics, dataset, xpos, ypos, true);

        // Restore the color, in case the box gets redrawn.
        graphics.setColor(_foreground);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void ptolemy.plot.PlotBox._drawPoint ( Graphics  graphics,
int  dataset,
long  xpos,
long  ypos,
boolean  clip 
) [inline, protected, inherited]

Put a mark corresponding to the specified dataset at the specified x and y position.

The mark is drawn in the current color. In this base class, a point is a filled rectangle 6 pixels across. Note that marks greater than about 6 pixels in size will not look very good since they will overlap axis labels and may not fit well in the legend. The clip argument, if true, states that the point should not be drawn if it is out of range.

Note that this method is not synchronized, so the caller should be. Moreover this method should always be called from the event thread when being used to write to the screen.

Parameters:
graphicsThe graphics context.
datasetThe index of the data set.
xposThe X position.
yposThe Y position.
clipIf true, do not draw if out of range.

Reimplemented in ptolemy.plot.Plot.

Definition at line 2524 of file PlotBox.java.

                                     {
        // Ignore if there is no graphics object to draw on.
        if (graphics == null) {
            return;
        }

        boolean pointinside = (ypos <= _lry) && (ypos >= _uly)
                && (xpos <= _lrx) && (xpos >= _ulx);

        if (!pointinside && clip) {
            return;
        }

        graphics.fillRect((int) xpos - 6, (int) ypos - 6, 6, 6);
    }

Here is the caller graph for this function:

void ptolemy.plot.Histogram._fillPlot ( ) [inline, private]

Definition at line 850 of file Histogram.java.

                             {
        super.fillPlot();
    }

Here is the caller graph for this function:

void ptolemy.plot.PlotBox._help ( ) [inline, protected, inherited]

Display basic information in its own window.

Definition at line 2543 of file PlotBox.java.

                           {
        String message = "Ptolemy plot package\n"
                + "By: Edward A. Lee\n"
                + "and Christopher Brooks\n"
                + "Version "
                + PTPLOT_RELEASE
                + ", Build: $Id: PlotBox.java,v 1.283.4.3 2008/04/01 01:19:02 cxh Exp $\n\n"
                + "Key bindings:\n"
                + "   Cntrl-c:  copy plot to clipboard (EPS format), if permitted\n"
                + "   D: dump plot data to standard out\n"
                + "   E: export plot to standard out (EPS format)\n"
                + "   F: fill plot\n"
                + "   H or ?: print help message (this message)\n"
                + "   Cntrl-D or Q: quit\n" + "For more information, see\n"
                + "http://ptolemy.eecs.berkeley.edu/java/ptplot\n";
        JOptionPane.showMessageDialog(this, message,
                "Ptolemy Plot Help Window", JOptionPane.INFORMATION_MESSAGE);
    }

Here is the caller graph for this function:

boolean ptolemy.plot.Histogram._parseLine ( String  line) [inline, protected]

Parse a line that gives plotting information.

Return true if the line is recognized. Lines with syntax errors are ignored.

Parameters:
lineA command line. It is not synchronized, so its caller should be.
Returns:
True if the line is recognized.

Reimplemented from ptolemy.plot.PlotBox.

Definition at line 541 of file Histogram.java.

                                              {
        // parse only if the super class does not recognize the line.
        if (super._parseLine(line)) {
            return true;
        } else {
            // We convert the line to lower case so that the command
            // names are case insensitive
            String lcLine = line.toLowerCase();

            if (lcLine.startsWith("dataset:")) {
                // new data set
                _currentdataset++;

                if (lcLine.length() > 0) {
                    String legend = (line.substring(8)).trim();

                    if ((legend != null) && (legend.length() > 0)) {
                        addLegend(_currentdataset, legend);
                    }
                }

                return true;
            } else if (lcLine.startsWith("bars:")
                    || lcLine.startsWith("bargraph:")) {
                // The PlotML code uses barGraph, but the older style
                // uses bars
                int comma = line.indexOf(",", 5);
                String barwidth;
                String baroffset = null;

                if (comma > 0) {
                    barwidth = (line.substring(5, comma)).trim();
                    baroffset = (line.substring(comma + 1)).trim();
                } else {
                    barwidth = (line.substring(5)).trim();
                }

                try {
                    Double bwidth = Double.valueOf(barwidth);
                    double boffset = _baroffset;

                    if (baroffset != null) {
                        boffset = (Double.valueOf(baroffset)).doubleValue();
                    }

                    setBars(bwidth.doubleValue(), boffset);
                } catch (NumberFormatException e) {
                    // ignore if format is bogus.
                }

                return true;
            } else if (lcLine.startsWith("binwidth:")) {
                String binwidth = (line.substring(9)).trim();

                try {
                    Double bwidth = Double.valueOf(binwidth);
                    setBinWidth(bwidth.doubleValue());
                } catch (NumberFormatException e) {
                    // ignore if format is bogus.
                }

                return true;
            } else if (lcLine.startsWith("binoffset:")) {
                String binoffset = (line.substring(10)).trim();

                try {
                    Double boffset = Double.valueOf(binoffset);
                    setBinOffset(boffset.doubleValue());
                } catch (NumberFormatException e) {
                    // ignore if format is bogus.
                }

                return true;
            } else if (lcLine.startsWith("numsets:")) {
                // Obsolete field... ignore.
                return true;
            } else if (line.startsWith("move:")) {
                // deal with 'move: 1 2' and 'move:2 2'
                line = line.substring(5, line.length()).trim();
            } else if (line.startsWith("move")) {
                // deal with 'move 1 2' and 'move2 2'
                line = line.substring(4, line.length()).trim();
            } else if (line.startsWith("draw:")) {
                // a connected point, if connect is enabled.
                line = line.substring(5, line.length()).trim();
            } else if (line.startsWith("draw")) {
                // a connected point, if connect is enabled.
                line = line.substring(4, line.length()).trim();
            }

            line = line.trim();

            // Handle Plot formats
            int fieldsplit = line.indexOf(",");

            if (fieldsplit == -1) {
                fieldsplit = line.indexOf(" ");
            }

            if (fieldsplit == -1) {
                fieldsplit = line.indexOf("\t"); // a tab
            }

            if (fieldsplit == -1) {
                // Have just one number per line
                try {
                    Double xpt = Double.valueOf(line);
                    addPoint(_currentdataset, xpt.doubleValue());
                    return true;
                } catch (NumberFormatException e) {
                    // ignore if format is bogus.
                }
            } else {
                String y = (line.substring(fieldsplit + 1)).trim();

                try {
                    Double ypt = Double.valueOf(y);
                    addPoint(_currentdataset, ypt.doubleValue());
                    return true;
                } catch (NumberFormatException e) {
                    // ignore if format is bogus.
                }
            }
        }

        return false;
    }

Here is the call graph for this function:

void ptolemy.plot.PlotBox._setButtonsVisibility ( boolean  vis) [inline, protected, inherited]

Set the visibility of the Fill button.

This is deprecated. Use setButtons().

Deprecated:

Definition at line 2683 of file PlotBox.java.

                                                      {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _printButton.setVisible(vis);
        _fillButton.setVisible(vis);
        _formatButton.setVisible(vis);
        _resetButton.setVisible(vis);
    }
void ptolemy.plot.PlotBox._setPadding ( double  padding) [inline, protected, inherited]

Set the padding multiple.

The plot rectangle can be "padded" in each direction -x, +x, -y, and +y. If the padding is set to 0.05 (and the padding is used), then there is 10% more length on each axis than set by the setXRange() and setYRange() methods, 5% in each direction.

Parameters:
paddingThe padding multiple.

Definition at line 2700 of file PlotBox.java.

                                               {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _padding = padding;
    }
void ptolemy.plot.PlotBox._writeOldSyntax ( PrintWriter  output) [inline, protected, inherited]

Write plot information to the specified output stream in the old PtPlot syntax.

Derived classes should override this method to first call the parent class method, then add whatever additional information they wish to add to the stream. It is not synchronized, so its caller should be.

Parameters:
outputA buffered print writer.
Deprecated:

Reimplemented in ptolemy.plot.Plot.

Definition at line 2716 of file PlotBox.java.

                                                       {
        output.println("# Ptolemy plot, version 2.0");

        if (_title != null) {
            output.println("TitleText: " + _title);
        }

        if (_xlabel != null) {
            output.println("XLabel: " + _xlabel);
        }

        if (_ylabel != null) {
            output.println("YLabel: " + _ylabel);
        }

        if (_xRangeGiven) {
            output.println("XRange: " + _xlowgiven + ", " + _xhighgiven);
        }

        if (_yRangeGiven) {
            output.println("YRange: " + _ylowgiven + ", " + _yhighgiven);
        }

        if ((_xticks != null) && (_xticks.size() > 0)) {
            output.print("XTicks: ");

            int last = _xticks.size() - 1;

            for (int i = 0; i < last; i++) {
                output.print("\"" + (String) _xticklabels.elementAt(i) + "\" "
                        + _xticks.elementAt(i) + ", ");
            }

            output.println("\"" + (String) _xticklabels.elementAt(last) + "\" "
                    + _xticks.elementAt(last));
        }

        if ((_yticks != null) && (_yticks.size() > 0)) {
            output.print("YTicks: ");

            int last = _yticks.size() - 1;

            for (int i = 0; i < last; i++) {
                output.print("\"" + (String) _yticklabels.elementAt(i) + "\" "
                        + _yticks.elementAt(i) + ", ");
            }

            output.println("\"" + (String) _yticklabels.elementAt(last) + "\" "
                    + _yticks.elementAt(last));
        }

        if (_xlog) {
            output.println("XLog: on");
        }

        if (_ylog) {
            output.println("YLog: on");
        }

        if (!_grid) {
            output.println("Grid: off");
        }

        if (_wrap) {
            output.println("Wrap: on");
        }

        if (!_usecolor) {
            output.println("Color: off");
        }
    }

Here is the caller graph for this function:

void ptolemy.plot.PlotBox._zoom ( int  x,
int  y 
) [inline, package, inherited]

Definition at line 3626 of file PlotBox.java.

                             {
        // FIXME: This is friendly because Netscape 4.0.3 cannot access it if
        // it is private!
        // NOTE: Due to a bug in JDK 1.1.7B, the BUTTON1_MASK does
        // not work on mouse drags, thus we have to use this variable
        // to determine whether we are actually zooming. It is used only
        // in _zoomBox, since calling this method is properly masked.
        _zooming = false;

        Graphics graphics = getGraphics();

        // Ignore if there is no graphics object to draw on.
        if (graphics == null) {
            return;
        }

        if ((_zoomin == true) && (_drawn == true)) {
            if ((_zoomxn != -1) || (_zoomyn != -1)) {
                // erase previous rectangle.
                int minx = Math.min(_zoomx, _zoomxn);
                int maxx = Math.max(_zoomx, _zoomxn);
                int miny = Math.min(_zoomy, _zoomyn);
                int maxy = Math.max(_zoomy, _zoomyn);
                graphics.setXORMode(_boxColor);
                graphics.drawRect(minx, miny, maxx - minx, maxy - miny);
                graphics.setPaintMode();

                // constrain to be in range
                if (y > _lry) {
                    y = _lry;
                }

                if (y < _uly) {
                    y = _uly;
                }

                if (x > _lrx) {
                    x = _lrx;
                }

                if (x < _ulx) {
                    x = _ulx;
                }

                // NOTE: ignore if total drag less than 5 pixels.
                if ((Math.abs(_zoomx - x) > 5) && (Math.abs(_zoomy - y) > 5)) {
                    double a = _xMin + ((_zoomx - _ulx) / _xscale);
                    double b = _xMin + ((x - _ulx) / _xscale);

                    // NOTE: It used to be that it was problematic to set
                    // the X range here because it conflicted with the wrap
                    // mechanism.  But now the wrap mechanism saves the state
                    // of the X range when the setWrap() method is called,
                    // so this is safe.
                    // EAL 6/12/00.
                    if (a < b) {
                        setXRange(a, b);
                    } else {
                        setXRange(b, a);
                    }

                    a = _yMax - ((_zoomy - _uly) / _yscale);
                    b = _yMax - ((y - _uly) / _yscale);

                    if (a < b) {
                        setYRange(a, b);
                    } else {
                        setYRange(b, a);
                    }
                }

                repaint();
            }
        } else if ((_zoomout == true) && (_drawn == true)) {
            // Erase previous rectangle.
            graphics.setXORMode(_boxColor);

            int x_diff = Math.abs(_zoomx - _zoomxn);
            int y_diff = Math.abs(_zoomy - _zoomyn);
            graphics.drawRect(_zoomx - 15 - x_diff, _zoomy - 15 - y_diff,
                    30 + (x_diff * 2), 30 + (y_diff * 2));
            graphics.setPaintMode();

            // Calculate zoom factor.
            double a = (Math.abs(_zoomx - x)) / 30.0;
            double b = (Math.abs(_zoomy - y)) / 30.0;
            double newx1 = _xMax + ((_xMax - _xMin) * a);
            double newx2 = _xMin - ((_xMax - _xMin) * a);

            // NOTE: To limit zooming out to the fill area, uncomment this...
            // if (newx1 > _xTop) newx1 = _xTop;
            // if (newx2 < _xBottom) newx2 = _xBottom;
            double newy1 = _yMax + ((_yMax - _yMin) * b);
            double newy2 = _yMin - ((_yMax - _yMin) * b);

            // NOTE: To limit zooming out to the fill area, uncomment this...
            // if (newy1 > _yTop) newy1 = _yTop;
            // if (newy2 < _yBottom) newy2 = _yBottom;
            zoom(newx2, newy2, newx1, newy1);
            repaint();
        } else if (_drawn == false) {
            repaint();
        }

        _drawn = false;
        _zoomin = _zoomout = false;
        _zoomxn = _zoomyn = _zoomx = _zoomy = -1;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void ptolemy.plot.PlotBox._zoomBox ( int  x,
int  y 
) [inline, package, inherited]

Definition at line 3746 of file PlotBox.java.

                                {
        // FIXME: This is friendly because Netscape 4.0.3 cannot access it if
        // it is private!
        // NOTE: Due to a bug in JDK 1.1.7B, the BUTTON1_MASK does
        // not work on mouse drags, thus we have to use this variable
        // to determine whether we are actually zooming.
        if (!_zooming) {
            return;
        }

        Graphics graphics = getGraphics();

        // Ignore if there is no graphics object to draw on.
        if (graphics == null) {
            return;
        }

        // Bound the rectangle so it doesn't go outside the box.
        if (y > _lry) {
            y = _lry;
        }

        if (y < _uly) {
            y = _uly;
        }

        if (x > _lrx) {
            x = _lrx;
        }

        if (x < _ulx) {
            x = _ulx;
        }

        // erase previous rectangle, if there was one.
        if (((_zoomx != -1) || (_zoomy != -1))) {
            // Ability to zoom out added by William Wu.
            // If we are not already zooming, figure out whether we
            // are zooming in or out.
            if ((_zoomin == false) && (_zoomout == false)) {
                if (y < _zoomy) {
                    _zoomout = true;

                    // Draw reference box.
                    graphics.setXORMode(_boxColor);
                    graphics.drawRect(_zoomx - 15, _zoomy - 15, 30, 30);
                } else if (y > _zoomy) {
                    _zoomin = true;
                }
            }

            if (_zoomin == true) {
                // Erase the previous box if necessary.
                if (((_zoomxn != -1) || (_zoomyn != -1)) && (_drawn == true)) {
                    int minx = Math.min(_zoomx, _zoomxn);
                    int maxx = Math.max(_zoomx, _zoomxn);
                    int miny = Math.min(_zoomy, _zoomyn);
                    int maxy = Math.max(_zoomy, _zoomyn);
                    graphics.setXORMode(_boxColor);
                    graphics.drawRect(minx, miny, maxx - minx, maxy - miny);
                }

                // Draw a new box if necessary.
                if (y > _zoomy) {
                    _zoomxn = x;
                    _zoomyn = y;

                    int minx = Math.min(_zoomx, _zoomxn);
                    int maxx = Math.max(_zoomx, _zoomxn);
                    int miny = Math.min(_zoomy, _zoomyn);
                    int maxy = Math.max(_zoomy, _zoomyn);
                    graphics.setXORMode(_boxColor);
                    graphics.drawRect(minx, miny, maxx - minx, maxy - miny);
                    _drawn = true;
                    return;
                } else {
                    _drawn = false;
                }
            } else if (_zoomout == true) {
                // Erase previous box if necessary.
                if (((_zoomxn != -1) || (_zoomyn != -1)) && (_drawn == true)) {
                    int x_diff = Math.abs(_zoomx - _zoomxn);
                    int y_diff = Math.abs(_zoomy - _zoomyn);
                    graphics.setXORMode(_boxColor);
                    graphics.drawRect(_zoomx - 15 - x_diff, _zoomy - 15
                            - y_diff, 30 + (x_diff * 2), 30 + (y_diff * 2));
                }

                if (y < _zoomy) {
                    _zoomxn = x;
                    _zoomyn = y;

                    int x_diff = Math.abs(_zoomx - _zoomxn);
                    int y_diff = Math.abs(_zoomy - _zoomyn);
                    graphics.setXORMode(_boxColor);
                    graphics.drawRect(_zoomx - 15 - x_diff, _zoomy - 15
                            - y_diff, 30 + (x_diff * 2), 30 + (y_diff * 2));
                    _drawn = true;
                    return;
                } else {
                    _drawn = false;
                }
            }
        }

        graphics.setPaintMode();
    }

Here is the caller graph for this function:

void ptolemy.plot.PlotBox._zoomStart ( int  x,
int  y 
) [inline, package, inherited]

Definition at line 3862 of file PlotBox.java.

                                  {
        // FIXME: This is friendly because Netscape 4.0.3 cannot access it if
        // it is private!
        // constrain to be in range
        if (y > _lry) {
            y = _lry;
        }

        if (y < _uly) {
            y = _uly;
        }

        if (x > _lrx) {
            x = _lrx;
        }

        if (x < _ulx) {
            x = _ulx;
        }

        _zoomx = x;
        _zoomy = y;
        _zooming = true;
    }

Here is the caller graph for this function:

void ptolemy.plot.Histogram.addLegend ( int  dataset,
String  legend 
) [inline]

Add a legend (displayed at the upper right) for the specified data set with the specified string.

Short strings generally fit better than long strings.

Parameters:
datasetThe dataset index.
legendThe label for the dataset.

Reimplemented from ptolemy.plot.PlotBox.

Definition at line 132 of file Histogram.java.

                                                      {
        _checkDatasetIndex(dataset);
        super.addLegend(dataset, legend);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void ptolemy.plot.Histogram.addPoint ( final int  dataset,
final double  value 
) [inline]

In the specified data set, add the specified value to the histogram.

Data set indices begin with zero. If the data set does not exist, create it. The new point will visibly alter the histogram if the plot is visible on the screen. Otherwise, it will be drawn the next time the histogram is drawn on the screen.

In order to work well with swing and be thread safe, this method actually defers execution to the event dispatch thread, where all user interface actions are performed. Thus, the point will not be added immediately (unless you call this method from within the event dispatch thread). All the methods that do this deferring coordinate so that they are executed in the order that you called them.

Parameters:
datasetThe data set index.
valueThe new value.

Definition at line 155 of file Histogram.java.

                                                                             {
        Runnable doAddPoint = new Runnable() {
            public void run() {
                _addPoint(dataset, value);
            }
        };

        deferIfNecessary(doAddPoint);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void ptolemy.plot.Histogram.addPoint ( int  dataset,
double  x,
double  y,
boolean  connected 
) [inline]

In the specified data set, add the specified y value to the histogram.

The x value and the connected arguments are ignored. Data set indices begin with zero. If the data set does not exist, create it.

Parameters:
datasetThe data set index.
xIgnored.
yThe Y position of the new point.
connectedIgnored

Definition at line 174 of file Histogram.java.

                               {
        addPoint(dataset, y);
    }

Here is the call graph for this function:

synchronized void ptolemy.plot.PlotBox.addXTick ( String  label,
double  position 
) [inline, inherited]

Specify a tick mark for the X axis.

The label given is placed on the axis at the position given by position. If this is called once or more, automatic generation of tick marks is disabled. The tick mark will appear only if it is within the X range.

Parameters:
labelThe label for the tick mark.
positionThe position on the X axis.

Definition at line 308 of file PlotBox.java.

                                                                     {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        if (_xticks == null) {
            _xticks = new Vector();
            _xticklabels = new Vector();
        }

        _xticks.addElement(Double.valueOf(position));
        _xticklabels.addElement(label);
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.addYTick ( String  label,
double  position 
) [inline, inherited]

Specify a tick mark for the Y axis.

The label given is placed on the axis at the position given by position. If this is called once or more, automatic generation of tick marks is disabled. The tick mark will appear only if it is within the Y range.

Parameters:
labelThe label for the tick mark.
positionThe position on the Y axis.

Definition at line 329 of file PlotBox.java.

                                                                     {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        if (_yticks == null) {
            _yticks = new Vector();
            _yticklabels = new Vector();
        }

        _yticks.addElement(Double.valueOf(position));
        _yticklabels.addElement(label);
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.Histogram.clear ( final boolean  format) [inline]

Clear the plot of all data points.

If the argument is true, then reset all parameters to their initial conditions, including the persistence, plotting format, and axes formats. For the change to take effect, you must call repaint().

In order to work well with swing and be thread safe, this method actually defers execution to the event dispatch thread, where all user interface actions are performed. Thus, the clear will not be executed immediately (unless you call this method from within the event dispatch thread). All the methods that do this deferring coordinate so that they are executed in the order that you called them.

Parameters:
formatIf true, clear the format controls as well.

Definition at line 194 of file Histogram.java.

                                                         {
        Runnable doClear = new Runnable() {
            public void run() {
                _clear(format);
            }
        };

        deferIfNecessary(doClear);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.clear ( boolean  axes) [inline, inherited]

If the argument is true, clear the axes.

I.e., set all parameters controlling the axes to their initial conditions. For the change to take effect, call repaint(). If the argument is false, do nothing.

Parameters:
axesIf true, clear the axes parameters.

Definition at line 348 of file PlotBox.java.

                                                 {
        // We need to repaint the offscreen buffer.
        _plotImage = null;

        _xBottom = Double.MAX_VALUE;
        _xTop = -Double.MAX_VALUE;
        _yBottom = Double.MAX_VALUE;
        _yTop = -Double.MAX_VALUE;

        if (axes) {
            // Protected members first.
            _yMax = 0;
            _yMin = 0;
            _xMax = 0;
            _xMin = 0;
            _xRangeGiven = false;
            _yRangeGiven = false;
            _originalXRangeGiven = false;
            _originalYRangeGiven = false;
            _rangesGivenByZooming = false;
            _xlog = false;
            _ylog = false;
            _grid = true;
            _wrap = false;
            _usecolor = true;

            // Private members next...
            _filespec = null;
            _xlabel = null;
            _ylabel = null;
            _title = null;
            _legendStrings = new Vector();
            _legendDatasets = new Vector();
            _xticks = null;
            _xticklabels = null;
            _yticks = null;
            _yticklabels = null;
        }
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.clearLegends ( ) [inline, inherited]

Clear all legends.

This will show up on the next redraw.

Definition at line 390 of file PlotBox.java.

                                            {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _legendStrings = new Vector();
        _legendDatasets = new Vector();
    }
void ptolemy.plot.PlotBox.deferIfNecessary ( Runnable  action) [inline, inherited]

If this method is called in the event thread, then simply execute the specified action.

Otherwise, if there are already deferred actions, then add the specified one to the list. Otherwise, create a list of deferred actions, if necessary, and request that the list be processed in the event dispatch thread.

Note that it does not work nearly as well to simply schedule the action yourself on the event thread because if there are a large number of actions, then the event thread will not be able to keep up. By grouping these actions, we avoid this problem.

This method is not synchronized, so the caller should be.

Parameters:
actionThe Runnable object to execute.

Definition at line 413 of file PlotBox.java.

                                                  {
        // In swing, updates to showing graphics must be done in the
        // event thread.  If we are in the event thread, then proceed.
        // Otherwise, queue a request or add to a pending request.
        if (EventQueue.isDispatchThread()) {
            action.run();
        } else {
            if (_deferredActions == null) {
                _deferredActions = new LinkedList();
            }

            // Add the specified action to the list of actions to perform.
            _deferredActions.add(action);

            // If it hasn't already been requested, request that actions
            // be performed in the event dispatch thread.
            if (!_actionsDeferred) {
                Runnable doActions = new Runnable() {
                    public void run() {
                        _executeDeferredActions();
                    }
                };

                try {
                    // NOTE: Using invokeAndWait() here risks causing
                    // deadlock.  Don't do it!
                    SwingUtilities.invokeLater(doActions);
                } catch (Exception ex) {
                    // Ignore InterruptedException.
                    // Other exceptions should not occur.
                }

                _actionsDeferred = true;
            }
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.export ( OutputStream  out) [inline, inherited]

Export a description of the plot.

Currently, only EPS is supported. But in the future, this may cause a dialog box to open to allow the user to select a format. If the argument is null, then the description goes to the clipboard. Otherwise, it goes to the specified file. To send it to standard output, use System.out as an argument.

Parameters:
outAn output stream to which to send the description.

Definition at line 459 of file PlotBox.java.

                                                      {
        try {
            EPSGraphics g = new EPSGraphics(out, _width, _height);
            _drawPlot(g, false);
            g.showpage();
        } catch (RuntimeException ex) {
            String message = "Export failed: " + ex.getMessage();
            JOptionPane.showMessageDialog(this, message,
                    "Ptolemy Plot Message", JOptionPane.ERROR_MESSAGE);

            // Rethrow the exception so that we don't report success,
            // and so the stack trace is displayed on standard out.
            throw (RuntimeException) ex.fillInStackTrace();
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized BufferedImage ptolemy.plot.PlotBox.exportImage ( ) [inline, inherited]

Create a BufferedImage and draw this plot to it.

The size of the returned image matches the current size of the plot. This method can be used, for example, by a servlet to produce an image, rather than requiring an applet to instantiate a PlotBox.

Returns:
An image filled by the plot.

Definition at line 490 of file PlotBox.java.

                                                    {
        Rectangle rectangle = new Rectangle(_preferredWidth, _preferredHeight);
        return exportImage(new BufferedImage(rectangle.width, rectangle.height,
                BufferedImage.TYPE_INT_ARGB), rectangle,
                _defaultImageRenderingHints(), false);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized BufferedImage ptolemy.plot.PlotBox.exportImage ( Rectangle  rectangle) [inline, inherited]

Create a BufferedImage the size of the given rectangle and draw this plot to it at the position specified by the rectangle.

The plot is rendered using anti-aliasing.

Parameters:
rectangleThe size of the plot. This method can be used, for example, by a servlet to produce an image, rather than requiring an applet to instantiate a PlotBox.
Returns:
An image containing the plot.

Definition at line 505 of file PlotBox.java.

                                                                       {
        return exportImage(new BufferedImage(rectangle.width, rectangle.height,
                BufferedImage.TYPE_INT_ARGB), rectangle,
                _defaultImageRenderingHints(), false);
    }

Here is the call graph for this function:

synchronized BufferedImage ptolemy.plot.PlotBox.exportImage ( BufferedImage  bufferedImage,
Rectangle  rectangle,
RenderingHints  hints,
boolean  transparent 
) [inline, inherited]

Draw this plot onto the specified image at the position of the specified rectangle with the size of the specified rectangle.

The plot is rendered using anti-aliasing. This can be used to paint a number of different plots onto a single buffered image. This method can be used, for example, by a servlet to produce an image, rather than requiring an applet to instantiate a PlotBox.

Parameters:
bufferedImageImage onto which the plot is drawn.
rectangleThe size and position of the plot in the image.
hintsRendering hints for this plot.
transparentIndicator that the background of the plot should not be painted.
Returns:
The modified bufferedImage.

Definition at line 525 of file PlotBox.java.

                                                                            {
        Graphics2D graphics = bufferedImage.createGraphics();
        graphics.addRenderingHints(_defaultImageRenderingHints());

        if (!transparent) {
            graphics.setColor(Color.white); // set the background color
            graphics.fill(rectangle);
        }

        _drawPlot(graphics, false, rectangle);
        return bufferedImage;
    }

Here is the call graph for this function:

synchronized BufferedImage ptolemy.plot.PlotBox.exportImage ( BufferedImage  bufferedImage) [inline, inherited]

Draw this plot onto the provided image.

This method does not paint the background, so the plot is transparent. The plot fills the image, and is rendered using anti-aliasing. This method can be used to overlay multiple plots on the same image, although you must use care to ensure that the axes and other labels are identical. Hence, it is usually better to simply combine data sets into a single plot.

Parameters:
bufferedImageThe image onto which to render the plot.
Returns:
The modified bufferedImage.

Definition at line 550 of file PlotBox.java.

                                                                               {
        return exportImage(bufferedImage, new Rectangle(bufferedImage
                .getWidth(), bufferedImage.getHeight()),
                _defaultImageRenderingHints(), true);
    }

Here is the call graph for this function:

synchronized void ptolemy.plot.Histogram.exportToPlot ( PrintWriter  output,
String  dtd 
) [inline]

Write plot data information to the specified output stream in PlotML, but in such a way that the Plot class can read it and reproduce the histogram.

The ordinary mechanism for saving the histogram records the raw data and the configuration to be used by this class.

Parameters:
outputA buffered print writer.
dtdThe DTD, or null to reference the default.

Definition at line 211 of file Histogram.java.

                                                                          {
        if (dtd == null) {
            output.println("<?xml version=\"1.0\" standalone=\"yes\"?>");
            output
                    .println("<!DOCTYPE plot PUBLIC \"-//UC Berkeley//DTD PlotML 1//EN\"");
            output
                    .println("    \"http://ptolemy.eecs.berkeley.edu/xml/dtd/PlotML_1.dtd\">");
        } else {
            output.println("<?xml version=\"1.0\" standalone=\"no\"?>");
            output.println("<!DOCTYPE plot SYSTEM \"" + dtd + "\">");
        }

        output.println("<plot>");
        output.println("<!-- Ptolemy plot, version " + PTPLOT_RELEASE
                + " , PlotML format. Exported from Histogram. -->");

        super.writeFormat(output);
        output.println("<barGraph width=\"" + (_barwidth * _binWidth)
                + "\" offset=\"" + (_baroffset * _binWidth) + "\"/>");

        for (int dataset = 0; dataset < _points.size(); dataset++) {
            // Write the dataset directive
            String legend = getLegend(dataset);

            if (legend != null) {
                output.println("<dataset name=\"" + legend
                        + "\" connected=\"no\">");
            } else {
                output.println("<dataset connected=\"no\">");
            }

            Hashtable data = (Hashtable) _histogram.elementAt(dataset);
            Enumeration keys = data.keys();

            while (keys.hasMoreElements()) {
                Integer bin = (Integer) keys.nextElement();
                Integer count = (Integer) data.get(bin);

                // The X axis value is a bit complex to get.
                int xValue = (int) ((bin.intValue() * _binWidth) + _binOffset);
                output.println("<p x=\"" + xValue + "\" y=\""
                        + count.intValue() + "\"/>");
            }

            output.println("</dataset>");
        }

        output.println("</plot>");
        output.flush();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void ptolemy.plot.Histogram.fillPlot ( ) [inline]

Rescale so that the data that is currently plotted just fits.

This overrides the base class method to ensure that the fill is actually performed in the event dispatch thread. In order to work well with swing and be thread safe, this method actually defers execution to the event dispatch thread, where all user interface actions are performed. Thus, the fill will not occur immediately (unless you call this method from within the event dispatch thread). All the methods that do this deferring coordinate so that they are executed in the order that you called them.

Reimplemented from ptolemy.plot.PlotBox.

Definition at line 273 of file Histogram.java.

                                        {
        Runnable doFill = new Runnable() {
            public void run() {
                _fillPlot();
            }
        };

        deferIfNecessary(doFill);
    }

Here is the call graph for this function:

boolean ptolemy.plot.PlotBox.getColor ( ) [inline, inherited]

Return whether the plot uses color.

Returns:
True if the plot uses color.

Definition at line 580 of file PlotBox.java.

                              {
        return _usecolor;
    }

Here is the caller graph for this function:

static Color ptolemy.plot.PlotBox.getColorByName ( String  name) [inline, static, inherited]

Convert a color name into a Color.

Currently, only a very limited set of color names is supported: black, white, red, green, and blue.

Parameters:
nameA color name, or null if not found.
Returns:
An instance of Color.

Definition at line 597 of file PlotBox.java.

                                                    {
        try {
            // Check to see if it is a hexadecimal
            if (name.startsWith("#")) {
                name = name.substring(1);
            }

            Color col = new Color(Integer.parseInt(name, 16));
            return col;
        } catch (NumberFormatException e) {
        }

        // FIXME: This is a poor excuse for a list of colors and values.
        // We should use a hash table here.
        // Note that Color decode() wants the values to start with 0x.
        String[][] names = { { "black", "00000" }, { "white", "ffffff" },
                { "red", "ff0000" }, { "green", "00ff00" },
                { "blue", "0000ff" } };

        for (int i = 0; i < names.length; i++) {
            if (name.equals(names[i][0])) {
                try {
                    Color col = new Color(Integer.parseInt(names[i][1], 16));
                    return col;
                } catch (NumberFormatException e) {
                }
            }
        }

        return null;
    }

Here is the caller graph for this function:

Color [] ptolemy.plot.PlotBox.getColors ( ) [inline, inherited]

Get the point colors.

Returns:
Array of colors
See also:
setColors(Color[])

Definition at line 588 of file PlotBox.java.

                               {
        return _colors;
    }
String ptolemy.plot.PlotBox.getDataurl ( ) [inline, inherited]

Get the file specification that was given by setDataurl.

This method is deprecated. Use read() instead.

Deprecated:

Definition at line 633 of file PlotBox.java.

                               {
        return _filespec;
    }
URL ptolemy.plot.PlotBox.getDocumentBase ( ) [inline, inherited]

Get the document base that was set by setDocumentBase.

This method is deprecated. Use read() instead.

Deprecated:

Definition at line 641 of file PlotBox.java.

                                 {
        return _documentBase;
    }
boolean ptolemy.plot.PlotBox.getGrid ( ) [inline, inherited]

Return whether the grid is drawn.

Returns:
True if a grid is drawn.

Definition at line 648 of file PlotBox.java.

                             {
        return _grid;
    }

Here is the caller graph for this function:

synchronized String ptolemy.plot.PlotBox.getLegend ( int  dataset) [inline, inherited]

Get the legend for a dataset, or null if there is none.

The legend would have been set by addLegend().

Parameters:
datasetThe dataset index.
Returns:
The legend label, or null if there is none.

Definition at line 657 of file PlotBox.java.

                                                      {
        int idx = _legendDatasets.indexOf(Integer.valueOf(dataset), 0);

        if (idx != -1) {
            return (String) _legendStrings.elementAt(idx);
        } else {
            return null;
        }
    }

Here is the caller graph for this function:

synchronized int ptolemy.plot.PlotBox.getLegendDataset ( String  legend) [inline, inherited]

Given a legend string, return the corresponding dataset or -1 if no legend was added with that legend string The legend would have been set by addLegend().

Parameters:
legendThe String naming the legend
Returns:
The legend dataset, or -1 if not found.
Since:
Ptplot 5.2p1

Definition at line 674 of file PlotBox.java.

                                                            {
        int index = _legendStrings.indexOf(legend);

        if (index == -1) {
            return -1;
        }

        return ((Integer) _legendDatasets.get(index)).intValue();
    }
Rectangle ptolemy.plot.PlotBox.getPlotRectangle ( ) [inline, inherited]

If the size of the plot has been set by setSize(), then return that size.

Otherwise, return what the superclass returns (which is undocumented, but apparently imposes no maximum size). Currently (JDK 1.3), only BoxLayout pays any attention to this.

Returns:
The maximum desired size. Get the minimum size of this component. This is simply the dimensions specified by setSize(), if this has been called. Otherwise, return whatever the base class returns, which is undocumented.
The minimum size. Get the current plot rectangle. Note that Rectangle returned by this method is calculated from the values of _ulx, _uly, _lrx and _lry. The value passed in by setPlotRectangle() is not directly used, thus calling getPlotRectangle() may not return the same rectangle that was passed in with setPlotRectangle().
Rectangle
See also:
setPlotRectangle(Rectangle)

Definition at line 722 of file PlotBox.java.

                                        {
        return new Rectangle(_ulx, _uly, _lrx - _ulx, _lry - _uly);
    }
synchronized Dimension ptolemy.plot.PlotBox.getPreferredSize ( ) [inline, inherited]

Get the preferred size of this component.

This is simply the dimensions specified by setSize(), if this has been called, or the default width and height otherwise (500 by 300).

Returns:
The preferred size.

Definition at line 732 of file PlotBox.java.

                                                     {
        return new Dimension(_preferredWidth, _preferredHeight);
    }
synchronized String ptolemy.plot.PlotBox.getTitle ( ) [inline, inherited]

Get the title of the graph, or an empty string if there is none.

Returns:
The title.

Definition at line 739 of file PlotBox.java.

                                          {
        if (_title == null) {
            return "";
        }

        return _title;
    }

Here is the caller graph for this function:

synchronized double [] ptolemy.plot.PlotBox.getXAutoRange ( ) [inline, inherited]

Get the range for X values of the data points registered so far.

Usually, derived classes handle managing the range by checking each new point against the current range.

Returns:
An array of two doubles where the first element is the minimum and the second element is the maximum.
See also:
getXRange()

Definition at line 754 of file PlotBox.java.

                                                 {
        double[] result = new double[2];
        result[0] = _xBottom;
        result[1] = _xTop;
        return result;
    }
synchronized String ptolemy.plot.PlotBox.getXLabel ( ) [inline, inherited]

Get the label for the X (horizontal) axis, or null if none has been set.

Returns:
The X label.

Definition at line 765 of file PlotBox.java.

                                           {
        return _xlabel;
    }

Here is the caller graph for this function:

boolean ptolemy.plot.PlotBox.getXLog ( ) [inline, inherited]

Return whether the X axis is drawn with a logarithmic scale.

Returns:
True if the X axis is logarithmic.

Definition at line 772 of file PlotBox.java.

                             {
        return _xlog;
    }
synchronized double [] ptolemy.plot.PlotBox.getXRange ( ) [inline, inherited]

Get the X range.

If setXRange(double, double) has been called, then this method returns the values passed in as arguments to setXRange(double, double). If setXRange(double, double) has not been called, then this method returns the range of the data to be plotted, which might not be all of the data due to zooming.

Returns:
An array of two doubles where the first element is the minimum and the second element is the maximum.
See also:
getXAutoRange()

Definition at line 786 of file PlotBox.java.

                                             {
        double[] result = new double[2];

        if (_xRangeGiven) {
            result[0] = _xlowgiven;
            result[1] = _xhighgiven;
        } else {
            // Have to first correct for the padding.
            result[0] = _xMin + ((_xMax - _xMin) * _padding);
            result[1] = _xMax - ((_xMax - _xMin) * _padding);
            ;
        }

        return result;
    }

Here is the caller graph for this function:

synchronized Vector [] ptolemy.plot.PlotBox.getXTicks ( ) [inline, inherited]

Get the X ticks that have been specified, or null if none.

The return value is an array with two vectors, the first of which specifies the X tick locations (as instances of Double), and the second of which specifies the corresponding labels.

Returns:
The X ticks.

Definition at line 808 of file PlotBox.java.

                                             {
        if (_xticks == null) {
            return null;
        }

        Vector[] result = new Vector[2];
        result[0] = _xticks;
        result[1] = _xticklabels;
        return result;
    }

Here is the caller graph for this function:

synchronized double [] ptolemy.plot.PlotBox.getYAutoRange ( ) [inline, inherited]

Get the range for Y values of the data points registered so far.

Usually, derived classes handle managing the range by checking each new point against the range.

Returns:
An array of two doubles where the first element is the minimum and the second element is the maximum.
See also:
getYRange()

Definition at line 826 of file PlotBox.java.

                                                 {
        double[] result = new double[2];
        result[0] = _yBottom;
        result[1] = _yTop;
        return result;
    }
String ptolemy.plot.PlotBox.getYLabel ( ) [inline, inherited]

Get the label for the Y (vertical) axis, or null if none has been set.

Returns:
The Y label.

Definition at line 837 of file PlotBox.java.

                              {
        return _ylabel;
    }

Here is the caller graph for this function:

boolean ptolemy.plot.PlotBox.getYLog ( ) [inline, inherited]

Return whether the Y axis is drawn with a logarithmic scale.

Returns:
True if the Y axis is logarithmic.

Definition at line 844 of file PlotBox.java.

                             {
        return _ylog;
    }
synchronized double [] ptolemy.plot.PlotBox.getYRange ( ) [inline, inherited]

Get the Y range.

If setYRange(double, double) has been called, then this method returns the values passed in as arguments to setYRange(double, double). If setYRange(double, double) has not been called, then this method returns the range of the data to be plotted, which might not be all of the data due to zooming.

Returns:
An array of two doubles where the first element is the minimum and the second element is the maximum.
See also:
getYAutoRange()

Definition at line 858 of file PlotBox.java.

                                             {
        double[] result = new double[2];

        if (_yRangeGiven) {
            result[0] = _ylowgiven;
            result[1] = _yhighgiven;
        } else {
            // Have to first correct for the padding.
            result[0] = _yMin + ((_yMax - _yMin) * _padding);
            result[1] = _yMax - ((_yMax - _yMin) * _padding);
            ;
        }

        return result;
    }

Here is the caller graph for this function:

synchronized Vector [] ptolemy.plot.PlotBox.getYTicks ( ) [inline, inherited]

Get the Y ticks that have been specified, or null if none.

The return value is an array with two vectors, the first of which specifies the Y tick locations (as instances of Double), and the second of which specifies the corresponding labels.

Returns:
The Y ticks.

Definition at line 880 of file PlotBox.java.

                                             {
        if (_yticks == null) {
            return null;
        }

        Vector[] result = new Vector[2];
        result[0] = _yticks;
        result[1] = _yticklabels;
        return result;
    }

Here is the caller graph for this function:

void ptolemy.plot.PlotBox.init ( ) [inline, inherited]

Initialize the component, creating the fill button and parsing an input file, if one has been specified.

This is deprecated. Call setButtons() and read() instead.

Deprecated:

Definition at line 896 of file PlotBox.java.

                       {
        setButtons(true);

        if (_filespec != null) {
            parseFile(_filespec, _documentBase);
        }
    }

Here is the call graph for this function:

synchronized void ptolemy.plot.PlotBox.paintComponent ( Graphics  graphics) [inline, inherited]

Paint the component contents, which in this base class is only the axes.

Parameters:
graphicsThe graphics context.

Definition at line 908 of file PlotBox.java.

                                                               {
        //  super.paintComponent(graphics);
        //         _drawPlot(graphics, true);
        BufferedImage newPlotImage = _plotImage;

        if (newPlotImage == null) {
            Rectangle bounds = getBounds();
            newPlotImage = new BufferedImage(bounds.width, bounds.height,
                    BufferedImage.TYPE_3BYTE_BGR);
            _plotImage = newPlotImage;

            Graphics2D offScreenGraphics = newPlotImage.createGraphics();
            super.paintComponent(offScreenGraphics);
            _drawPlot(offScreenGraphics, true);
        }

        // Blit the offscreen image onto the screen.
        graphics.drawImage(newPlotImage, 0, 0, null);

        // Acquire the focus so that key bindings work.
        // NOTE: no longer needed?
        // requestFocus();
    }

Here is the call graph for this function:

void ptolemy.plot.PlotBox.parseFile ( String  filespec) [inline, inherited]

Syntactic sugar for parseFile(filespec, documentBase).

This method is deprecated. Use read() to read the old file format, or use one of the classes in the plotml package to read the XML-based file format.

Deprecated:

Definition at line 938 of file PlotBox.java.

                                           {
        parseFile(filespec, (URL) null);
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.parseFile ( String  filespec,
URL  documentBase 
) [inline, inherited]

Open up the input file, which could be stdin, a URL, or a file.

Deprecated:
This method is deprecated. Use read() instead.

Reimplemented in ptolemy.plot.Plot.

Definition at line 945 of file PlotBox.java.

                                                                          {
        DataInputStream in = null;

        if ((filespec == null) || (filespec.length() == 0)) {
            // Open up stdin
            in = new DataInputStream(System.in);
        } else {
            try {
                URL url = null;

                if ((documentBase == null) && (_documentBase != null)) {
                    documentBase = _documentBase;
                }

                if (documentBase == null) {
                    url = new URL(filespec);
                } else {
                    try {
                        url = new URL(documentBase, filespec);
                    } catch (NullPointerException e) {
                        // If we got a NullPointerException, then perhaps we
                        // are calling this as an application, not as an applet
                        url = new URL(filespec);
                    }
                }

                in = new DataInputStream(url.openStream());
            } catch (MalformedURLException e) {
                try {
                    // Just try to open it as a file.
                    in = new DataInputStream(new FileInputStream(filespec));
                } catch (FileNotFoundException me) {
                    _errorMsg = new String[2];
                    _errorMsg[0] = "File not found: " + filespec;
                    _errorMsg[1] = me.getMessage();
                    return;
                } catch (SecurityException me) {
                    _errorMsg = new String[2];
                    _errorMsg[0] = "Security Exception: " + filespec;
                    _errorMsg[1] = me.getMessage();
                    return;
                }
            } catch (IOException ioe) {
                _errorMsg = new String[3];
                _errorMsg[0] = "Failure opening URL: ";
                _errorMsg[1] = " " + filespec;
                _errorMsg[2] = ioe.getMessage();
                return;
            }
        }

        // At this point, we've opened the data source, now read it in
        try {
            BufferedReader din = new BufferedReader(new InputStreamReader(in));
            String line = din.readLine();

            while (line != null) {
                _parseLine(line);
                line = din.readLine();
            }
        } catch (MalformedURLException e) {
            _errorMsg = new String[2];
            _errorMsg[0] = "Malformed URL: " + filespec;
            _errorMsg[1] = e.getMessage();
            return;
        } catch (IOException e) {
            _errorMsg = new String[2];
            _errorMsg[0] = "Failure reading data: " + filespec;
            _errorMsg[1] = e.getMessage();
            _errorMsg[1] = e.getMessage();
        } finally {
            try {
                in.close();
            } catch (IOException me) {
            }
        }
    }

Here is the call graph for this function:

synchronized int ptolemy.plot.PlotBox.print ( Graphics  graphics,
PageFormat  format,
int  index 
) throws PrinterException [inline, inherited]

Print the plot to a printer, represented by the specified graphics object.

Parameters:
graphicsThe context into which the page is drawn.
formatThe size and orientation of the page being drawn.
indexThe zero based index of the page to be drawn.
Returns:
PAGE_EXISTS if the page is rendered successfully, or NO_SUCH_PAGE if pageIndex specifies a non-existent page.
Exceptions:
PrinterExceptionIf the print job is terminated.

Definition at line 1032 of file PlotBox.java.

                                               {

        if (graphics == null) {
            return Printable.NO_SUCH_PAGE;
        }

        // We only print on one page.
        if (index >= 1) {
            return Printable.NO_SUCH_PAGE;
        }

        Graphics2D graphics2D = (Graphics2D) graphics;

        // Scale the printout to fit the pages.
        // Contributed by Laurent ETUR, Schlumberger Riboud Product Center
        double scalex = format.getImageableWidth() / getWidth();
        double scaley = format.getImageableHeight() / getHeight();
        double scale = Math.min(scalex, scaley);
        graphics2D.translate((int) format.getImageableX(), (int) format
                .getImageableY());
        graphics2D.scale(scale, scale);
        _drawPlot(graphics, true);
        return Printable.PAGE_EXISTS;
    }

Here is the call graph for this function:

synchronized void ptolemy.plot.PlotBox.read ( InputStream  in) throws IOException [inline, inherited]

Read commands and/or plot data from an input stream in the old (non-XML) file syntax.

To update the display, call repaint(), or make the plot visible with setVisible(true).

To read from standard input, use:

     read(System.in);
  

To read from a url, use:

     read(url.openStream());
  

To read a URL from within an applet, use:

     URL url = new URL(getDocumentBase(), urlSpec);
     read(url.openStream());
  

Within an application, if you have an absolute URL, use:

     URL url = new URL(urlSpec);
     read(url.openStream());
  

To read from a file, use:

     read(new FileInputStream(filename));
  
Parameters:
inThe input stream.
Exceptions:
IOExceptionIf the stream cannot be read.

Reimplemented in ptolemy.plot.Plot.

Definition at line 1088 of file PlotBox.java.

                                                                     {
        try {
            // NOTE: I tried to use exclusively the jdk 1.1 Reader classes,
            // but they provide no support like DataInputStream, nor
            // support for URL accesses.  So I use the older classes
            // here in a strange mixture.
            BufferedReader din = new BufferedReader(new InputStreamReader(in));

            try {
                String line = din.readLine();

                while (line != null) {
                    _parseLine(line);
                    line = din.readLine();
                }
            } finally {
                din.close();
            }
        } catch (IOException e) {
            _errorMsg = new String[2];
            _errorMsg[0] = "Failure reading input data.";
            _errorMsg[1] = e.getMessage();
            throw e;
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.read ( String  command) [inline, inherited]

Read a single line command provided as a string.

The commands can be any of those in the ASCII file format.

Parameters:
commandA command.

Definition at line 1118 of file PlotBox.java.

                                                  {
        _parseLine(command);
    }

Here is the call graph for this function:

String ptolemy.plot.PlotBox.ReadPlotApplet ( ) [inline, inherited]

Definition at line 246 of file PlotBox.java.

                                  {                                                                                                        
        String reply="error\nReadApplet() not implemented\nNO SENSIBLE USER INTERACTION PRESENT";                                          
        return reply;                                                                                                                      
    }                                                                                                                                      

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.removeLegend ( int  dataset) [inline, inherited]

Remove the legend (displayed at the upper right) for the specified data set.

If the dataset is not found, nothing will occur. The PlotBox must be repainted in order for this to take effect.

Parameters:
datasetThe dataset index.

Definition at line 1127 of file PlotBox.java.

                                                       {
        final int len = _legendDatasets.size();
        int foundIndex = -1;
        boolean found = false;

        for (int i = 0; (i < len) && !found; ++i) {
            if (((Integer) _legendDatasets.get(i)).intValue() == dataset) {
                foundIndex = i;
                found = true;
            }
        }

        if (found) {
            _legendDatasets.remove(foundIndex);
            _legendStrings.remove(foundIndex);
        }
    }
synchronized void ptolemy.plot.PlotBox.renameLegend ( int  dataset,
String  newName 
) [inline, inherited]

Rename a legend.

Parameters:
datasetThe dataset of the legend to be renamed. If there is no dataset with this value, then nothing happens.
newNameThe new name of legend.
See also:
addLegend(int, String)

Definition at line 1151 of file PlotBox.java.

                                                                       {
        int index = _legendDatasets.indexOf(Integer.valueOf(dataset), 0);

        if (index != -1) {
            _legendStrings.setElementAt(newName, index);

            // Changing legend means we need to repaint the offscreen buffer.
            _plotImage = null;
        }
    }
synchronized void ptolemy.plot.PlotBox.resetAxes ( ) [inline, inherited]

Reset the X and Y axes to the ranges that were first specified using setXRange() and setYRange().

If these methods have not been called, then reset to the default ranges. This method calls repaint(), which eventually causes the display to be updated.

Definition at line 1168 of file PlotBox.java.

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void ptolemy.plot.Histogram.samplePlot ( ) [inline]

Create a sample plot.

Reimplemented from ptolemy.plot.PlotBox.

Definition at line 285 of file Histogram.java.

                                          {
        // Create a sample plot.
        clear(true);

        setTitle("Sample histogram");
        setXLabel("values");
        setYLabel("count");

        Random random = new Random();

        for (int i = 0; i <= 1000; i++) {
            this.addPoint(0, 5.0 * Math.cos((Math.PI * i) / 500.0));
            this.addPoint(1, (10.0 * random.nextDouble()) - 5.0);
            this.addPoint(2, 2.0 * random.nextGaussian());
        }

        this.repaint();
    }

Here is the call graph for this function:

synchronized void ptolemy.plot.PlotBox.setBackground ( Color  background) [inline, inherited]

Set the background color.

Parameters:
backgroundThe background color.

Definition at line 1184 of file PlotBox.java.

                                                             {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _background = background;
        super.setBackground(_background);
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.Histogram.setBars ( double  width,
double  offset 
) [inline]

Set the width and offset of the bars.

Both are specified as a fraction of a bin width. The offset is the amount by which the i < sup>th data set is shifted to the right, so that it peeks out from behind the earlier data sets.

Parameters:
widthThe width of the bars.
offsetThe offset per data set.

Definition at line 311 of file Histogram.java.

                                                                  {
        // Ensure replot of offscreen buffer.
        _plotImage = null;
        _barwidth = width;
        _baroffset = offset;
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.Histogram.setBinOffset ( double  offset) [inline]

Set the offset of the bins, in whatever units the data are given.

Without calling this, each bin is centered at x = nw, where w is the width of the bin and n is an integer. That bin represents values in the range (x - w/2, x + w/2). If this method is called with argument o, then each bin is centered at x = nw + o, and represents values in the range (x - w/2 + o, x + w/2 + o). So for example, if o = w/2, then each bin represents values from nw to (n + 1)w) for some integer n.

Parameters:
offsetThe bin offset.

Definition at line 329 of file Histogram.java.

                                                         {
        // Ensure replot of offscreen buffer.
        _plotImage = null;
        _binOffset = offset;
    }

Here is the caller graph for this function:

void ptolemy.plot.Histogram.setBinWidth ( double  width) [inline]

Set the width of the bins, in whatever units the data are given.

Parameters:
widthThe width of the bins.

Definition at line 338 of file Histogram.java.

                                          {
        // Ensure replot of offscreen buffer.
        _plotImage = null;
        _binWidth = width;
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.setBounds ( int  x,
int  y,
int  width,
int  height 
) [inline, inherited]

Move and resize this component.

The new location of the top-left corner is specified by x and y, and the new size is specified by width and height. This overrides the base class method to make a record of the new size.

Parameters:
xThe new x-coordinate of this component.
yThe new y-coordinate of this component.
widthThe new width of this component.
heightThe new height of this component.

Definition at line 1201 of file PlotBox.java.

                                                                            {
        _width = width;
        _height = height;

        // Resizing the component means we need to redraw the buffer.
        _plotImage = null;

        super.setBounds(x, y, _width, _height);
    }
synchronized void ptolemy.plot.PlotBox.setButtons ( boolean  visible) [inline, inherited]

If the argument is true, make a fill button visible at the upper right.

This button auto-scales the plot. NOTE: The button may infringe on the title space, if the title is long. In an application, it is preferable to provide a menu with the fill command. This way, when printing the plot, the printed plot will not have a spurious button. Thus, this method should be used only by applets, which normally do not have menus. This method should only be called from within the event dispatch thread, since it interacts with swing.

Reimplemented in ptolemy.plot.PlotLive.

Definition at line 1221 of file PlotBox.java.

                                                         {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        if (_printButton == null) {
            // Load the image by using the absolute path to the gif.
            URL img = null;
            try {
                // FindBugs: Usage of GetResource may be unsafe if
                // class is extended
                img = FileUtilities.nameToURL(
                        "$CLASSPATH/ptolemy/plot/img/print.gif", null, null);
            } catch (IOException ex) {
                ex.printStackTrace();
            }

            if (img != null) {
                ImageIcon printIcon = new ImageIcon(img);
                _printButton = new JButton(printIcon);
                _printButton.setBorderPainted(false);
            } else {
                // Backup in case something goes wrong with the
                // class loader.
                _printButton = new JButton("P");
            }

            // FIXME: If we failed to get an image, then the letter "P"
            // Is not likely to fit into a 20x20 button.
            _printButton.setPreferredSize(new Dimension(20, 20));
            _printButton.setToolTipText("Print the plot.");
            _printButton.addActionListener(new ButtonListener());
            add(_printButton);
        }

        _printButton.setVisible(visible);

        if (_resetButton == null) {
            // Load the image by using the absolute path to the gif.
            URL img = null;
            try {
                // FindBugs: Usage of GetResource may be unsafe if
                // class is extended
                img = FileUtilities.nameToURL(
                        "$CLASSPATH/ptolemy/plot/img/reset.gif", null, null);
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            if (img != null) {
                ImageIcon resetIcon = new ImageIcon(img);
                _resetButton = new JButton(resetIcon);
                _resetButton.setBorderPainted(false);
            } else {
                // Backup in case something goes wrong with the
                // class loader.
                _resetButton = new JButton("R");
            }

            // FIXME: If we failed to get an image, then the letter "R"
            // Is not likely to fit into a 20x20 button.
            _resetButton.setPreferredSize(new Dimension(20, 20));
            _resetButton
                    .setToolTipText("Reset X and Y ranges to their original values");
            _resetButton.addActionListener(new ButtonListener());
            add(_resetButton);
        }

        _resetButton.setVisible(visible);

        if (_formatButton == null) {
            // Load the image by using the absolute path to the gif.
            URL img = null;
            try {
                // FindBugs: Usage of GetResource may be unsafe if
                // class is extended
                img = FileUtilities.nameToURL(
                        "$CLASSPATH/ptolemy/plot/img/format.gif", null, null);
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            if (img != null) {
                ImageIcon formatIcon = new ImageIcon(img);
                _formatButton = new JButton(formatIcon);
                _formatButton.setBorderPainted(false);
            } else {
                // Backup in case something goes wrong with the
                // class loader.
                _formatButton = new JButton("S");
            }

            // FIXME: If we failed to get an image, then the letter "S"
            // Is not likely to fit into a 20x20 button.
            _formatButton.setPreferredSize(new Dimension(20, 20));
            _formatButton.setToolTipText("Set the plot format");
            _formatButton.addActionListener(new ButtonListener());
            add(_formatButton);
        }

        _formatButton.setVisible(visible);

        if (_fillButton == null) {
            // Load the image by using the absolute path to the gif.
            URL img = null;
            try {
                // FindBugs: Usage of GetResource may be unsafe if
                // class is extended
                img = FileUtilities.nameToURL(
                        "$CLASSPATH/ptolemy/plot/img/fill.gif", null, null);
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            if (img != null) {
                ImageIcon fillIcon = new ImageIcon(img);
                _fillButton = new JButton(fillIcon);
                _fillButton.setBorderPainted(false);
            } else {
                // Backup in case something goes wrong with the
                // class loader.
                _fillButton = new JButton("F");
            }

            // FIXME: If we failed to get an image, then the letter "F"
            // Is not likely to fit into a 20x20 button.
            _fillButton.setPreferredSize(new Dimension(20, 20));
            _fillButton.setToolTipText("Rescale the plot to fit the data");
            _fillButton.addActionListener(new ButtonListener());
            add(_fillButton);
        }

        _fillButton.setVisible(visible);

        // Request the focus so that key events are heard.
        // NOTE: no longer needed?
        // requestFocus();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.setColor ( boolean  useColor) [inline, inherited]

If the argument is false, draw the plot without using color (in black and white).

Otherwise, draw it in color (the default).

Parameters:
useColorFalse to draw in back and white.

Definition at line 1360 of file PlotBox.java.

                                                        {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _usecolor = useColor;
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.setColors ( Color[]  colors) [inline, inherited]

Set the point colors.

Note that the default colors have been carefully selected to maximize readability and that it is easy to use colors that result in a very ugly plot.

Parameters:
colorsArray of colors to use in succession for data sets.
See also:
getColors()

Definition at line 1373 of file PlotBox.java.

                                                       {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _colors = colors;
    }
void ptolemy.plot.PlotBox.setDataurl ( String  filespec) [inline, inherited]

Set the file to read when init() is called.

This method is deprecated. Use read() instead.

Deprecated:

Definition at line 1384 of file PlotBox.java.

                                            {
        _filespec = filespec;
    }
void ptolemy.plot.PlotBox.setDocumentBase ( URL  documentBase) [inline, inherited]

Set the document base to used when init() is called to read a URL.

This method is deprecated. Use read() instead.

Deprecated:

Definition at line 1392 of file PlotBox.java.

                                                  {
        _documentBase = documentBase;
    }
synchronized void ptolemy.plot.PlotBox.setForeground ( Color  foreground) [inline, inherited]

Set the foreground color.

Parameters:
foregroundThe foreground color.

Definition at line 1399 of file PlotBox.java.

                                                             {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _foreground = foreground;
        super.setForeground(_foreground);
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.setGrid ( boolean  grid) [inline, inherited]

Control whether the grid is drawn.

Parameters:
gridIf true, a grid is drawn.

Definition at line 1410 of file PlotBox.java.

                                                   {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _grid = grid;
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.setLabelFont ( String  name) [inline, inherited]

Set the label font, which is used for axis labels and legend labels.

The font names understood are those understood by java.awt.Font.decode().

Parameters:
nameA font name.

Definition at line 1422 of file PlotBox.java.

                                                       {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _labelFont = Font.decode(name);
        _labelFontMetrics = getFontMetrics(_labelFont);
    }
synchronized void ptolemy.plot.PlotBox.setPlotRectangle ( Rectangle  rectangle) [inline, inherited]

Set the plot rectangle inside the axes.

This method can be used to create two plots that share the same axes.

Parameters:
rectangleRectangle space inside axes.
See also:
getPlotRectangle()

Definition at line 1435 of file PlotBox.java.

                                                                   {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _specifiedPlotRectangle = rectangle;
    }
synchronized void ptolemy.plot.PlotBox.setSize ( int  width,
int  height 
) [inline, inherited]

Set the size of the plot.

This overrides the base class to make it work. In particular, it records the specified size so that getMinimumSize() and getPreferredSize() return the specified value. However, it only works if the plot is placed in its own JPanel. This is because the JPanel asks the contained component for its preferred size before determining the size of the panel. If the plot is placed directly in the content pane of a JApplet, then, mysteriously, this method has no effect.

Parameters:
widthThe width, in pixels.
heightThe height, in pixels.

Definition at line 1453 of file PlotBox.java.

                                                            {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _width = width;
        _height = height;
        _preferredWidth = width;
        _preferredHeight = height;

        //_sizeHasBeenSet = true;
        super.setSize(width, height);
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.setTitle ( String  title) [inline, inherited]

Set the title of the graph.

Parameters:
titleThe title.

Definition at line 1469 of file PlotBox.java.

                                                    {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _title = title;
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.setTitleFont ( String  name) [inline, inherited]

Set the title font.

The font names understood are those understood by java.awt.Font.decode().

Parameters:
nameA font name.

Definition at line 1481 of file PlotBox.java.

                                                       {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _titleFont = Font.decode(name);
        _titleFontMetrics = getFontMetrics(_titleFont);
    }
synchronized void ptolemy.plot.PlotBox.setWrap ( boolean  wrap) [inline, inherited]

Specify whether the X axis is wrapped.

If it is, then X values that are out of range are remapped to be in range using modulo arithmetic. The X range is determined by the most recent call to setXRange() (or the most recent zoom). If the X range has not been set, then use the default X range, or if data has been plotted, then the current fill range.

Parameters:
wrapIf true, wrapping of the X axis is enabled.

Definition at line 1497 of file PlotBox.java.

                                                   {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _wrap = wrap;

        if (!_xRangeGiven) {
            if (_xBottom > _xTop) {
                // have nothing to go on.
                setXRange(0, 0);
            } else {
                setXRange(_xBottom, _xTop);
            }
        }

        _wrapLow = _xlowgiven;
        _wrapHigh = _xhighgiven;
    }

Here is the call graph for this function:

synchronized void ptolemy.plot.PlotBox.setXLabel ( String  label) [inline, inherited]

Set the label for the X (horizontal) axis.

Parameters:
labelThe label.

Definition at line 1519 of file PlotBox.java.

                                                     {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _xlabel = label;
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.setXLog ( boolean  xlog) [inline, inherited]

Specify whether the X axis is drawn with a logarithmic scale.

If you would like to have the X axis drawn with a logarithmic axis, then setXLog(true) should be called before adding any data points.

Parameters:
xlogIf true, logarithmic axis is used.

Definition at line 1532 of file PlotBox.java.

                                                   {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _xlog = xlog;
    }
synchronized void ptolemy.plot.PlotBox.setXRange ( double  min,
double  max 
) [inline, inherited]

Set the X (horizontal) range of the plot.

If this is not done explicitly, then the range is computed automatically from data available when the plot is drawn. If min and max are identical, then the range is arbitrarily spread by 1.

Parameters:
minThe left extent of the range.
maxThe right extent of the range.

Definition at line 1546 of file PlotBox.java.

                                                               {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _xRangeGiven = true;
        _xlowgiven = min;
        _xhighgiven = max;
        _setXRange(min, max);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.setYLabel ( String  label) [inline, inherited]

Set the label for the Y (vertical) axis.

Parameters:
labelThe label.

Definition at line 1559 of file PlotBox.java.

                                                     {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _ylabel = label;
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.setYLog ( boolean  ylog) [inline, inherited]

Specify whether the Y axis is drawn with a logarithmic scale.

If you would like to have the Y axis drawn with a logarithmic axis, then setYLog(true) should be called before adding any data points.

Parameters:
ylogIf true, logarithmic axis is used.

Definition at line 1572 of file PlotBox.java.

                                                   {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _ylog = ylog;
    }
synchronized void ptolemy.plot.PlotBox.setYRange ( double  min,
double  max 
) [inline, inherited]

Set the Y (vertical) range of the plot.

If this is not done explicitly, then the range is computed automatically from data available when the plot is drawn. If min and max are identical, then the range is arbitrarily spread by 0.1.

Parameters:
minThe bottom extent of the range.
maxThe top extent of the range.

Definition at line 1586 of file PlotBox.java.

                                                               {
        // Changing legend means we need to repaint the offscreen buffer.
        _plotImage = null;

        _yRangeGiven = true;
        _ylowgiven = min;
        _yhighgiven = max;
        _setYRange(min, max);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void ptolemy.plot.Histogram.write ( Writer  out,
String  dtd 
) [inline]

Write the current data and plot configuration to the specified stream in PlotML syntax.

This writes the histogram, not the raw data, in such a way that the Plot class (not the Histogram class) will correctly render it. The URL (relative or absolute) for the DTD is given as the second argument. If that argument is null, then the PlotML PUBLIC DTD is referenced, resulting in a file that can be read by a PlotML parser without any external file references, as long as that parser has local access to the DTD. The output is buffered, and is flushed before exiting.

Parameters:
outAn output writer.
dtdThe reference (URL) for the DTD, or null to use the PUBLIC DTD.

Reimplemented from ptolemy.plot.PlotBox.

Definition at line 358 of file Histogram.java.

                                                           {
        // Auto-flush is disabled.
        PrintWriter output = new PrintWriter(new BufferedWriter(out), false);
        exportToPlot(output, dtd);
    }

Here is the call graph for this function:

void ptolemy.plot.PlotBox.write ( OutputStream  out) [inline, inherited]

Write the current data and plot configuration to the specified stream in PlotML syntax.

PlotML is an XML extension for plot data. The written information is standalone, in that it includes the DTD (document type definition). This makes is somewhat verbose. To get smaller files, use the two argument version of write(). The output is buffered, and is flushed and closed before exiting. Derived classes should override writeFormat and writeData rather than this method.

Parameters:
outAn output stream.

Definition at line 1607 of file PlotBox.java.

                                        {
        write(out, null);
    }

Here is the caller graph for this function:

synchronized void ptolemy.plot.PlotBox.write ( OutputStream  out,
String  dtd 
) [inline, inherited]

Write the current data and plot configuration to the specified stream in PlotML syntax.

PlotML is an XML scheme for plot data. The URL (relative or absolute) for the DTD is given as the second argument. If that argument is null, then the PlotML PUBLIC DTD is referenced, resulting in a file that can be read by a PlotML parser without any external file references, as long as that parser has local access to the DTD. The output is buffered, and is flushed and closed before exiting. Derived classes should override writeFormat and writeData rather than this method.

Parameters:
outAn output stream.
dtdThe reference (URL) for the DTD, or null to use the PUBLIC DTD.

Definition at line 1625 of file PlotBox.java.

                                                                 {
        write(new OutputStreamWriter(out), dtd);
    }

Here is the call graph for this function:

synchronized void ptolemy.plot.Histogram.writeData ( PrintWriter  output) [inline]

Write plot data information to the specified output stream in PlotML.

Parameters:
outputA buffered print writer.

Reimplemented from ptolemy.plot.PlotBox.

Definition at line 367 of file Histogram.java.

                                                           {
        super.writeData(output);

        for (int dataset = 0; dataset < _points.size(); dataset++) {
            // Write the dataset directive
            String legend = getLegend(dataset);

            if (legend != null) {
                output.println("<dataset name=\"" + legend + "\">");
            } else {
                output.println("<dataset>");
            }

            // Write the data
            Vector pts = (Vector) _points.elementAt(dataset);

            for (int pointnum = 0; pointnum < pts.size(); pointnum++) {
                Double pt = (Double) pts.elementAt(pointnum);
                output.println("<p y=\"" + pt.doubleValue() + "\"/>");
            }

            output.println("</dataset>");
        }
    }

Here is the call graph for this function:

synchronized void ptolemy.plot.Histogram.writeFormat ( PrintWriter  output) [inline]

Write plot format information to the specified output stream.

Parameters:
outputA buffered print writer.

Reimplemented from ptolemy.plot.PlotBox.

Definition at line 395 of file Histogram.java.

                                                             {
        super.writeFormat(output);

        // NOTE: Regrettably, the meaning of the barGraph data is
        // different for a histogram than for a normal plot.
        // In a histogram, it is proportional to the bin width.
        // Thus, this is not the same as the corresponding line
        // in exportToPlot().
        output.println("<barGraph width=\"" + _barwidth + "\" offset=\""
                + _baroffset + "\"/>");

        output.println("<bin width=\"" + _binWidth + "\" offset=\""
                + _binOffset + "\"/>");
    }
synchronized void ptolemy.plot.PlotBox.writeOldSyntax ( OutputStream  out) [inline, inherited]

Write the current data and plot configuration to the specified stream in the old PtPlot syntax.

The output is buffered, and is flushed and closed before exiting. Derived classes should override _writeOldSyntax() rather than this method.

Parameters:
outAn output stream.
Deprecated:

Definition at line 1767 of file PlotBox.java.

                                                              {
        // Auto-flush is disabled.
        PrintWriter output = new PrintWriter(new BufferedOutputStream(out),
                false);
        _writeOldSyntax(output);
        output.flush();

        // Avoid closing standard out.
        if (out != System.out) {
            output.close();
        }
    }

Here is the call graph for this function:

synchronized void ptolemy.plot.PlotBox.zoom ( double  lowx,
double  lowy,
double  highx,
double  highy 
) [inline, inherited]

Zoom in or out to the specified rectangle.

This method calls repaint().

Parameters:
lowxThe low end of the new X range.
lowyThe low end of the new Y range.
highxThe high end of the new X range.
highyThe high end of the new Y range.

Definition at line 1787 of file PlotBox.java.

                          {
        setXRange(lowx, highx);
        setYRange(lowy, highy);
        repaint();
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Color ptolemy.plot.PlotBox._background = Color.white [protected, inherited]

Color of the background, settable from HTML.

Definition at line 2885 of file PlotBox.java.

double ptolemy.plot.Histogram._baroffset = 0.15 [private]

The offset between bars.

Definition at line 861 of file Histogram.java.

double ptolemy.plot.Histogram._barwidth = 0.5 [private]

The width of a bar.

Definition at line 858 of file Histogram.java.

double ptolemy.plot.Histogram._binOffset = 0.5 [private]

The offset between bins.

Definition at line 867 of file Histogram.java.

double ptolemy.plot.Histogram._binWidth = 1.0 [private]

The width of a bin.

Definition at line 864 of file Histogram.java.

int ptolemy.plot.PlotBox._bottomPadding = 5 [protected, inherited]

Bottom padding.

Derived classes can increment these to make space around the plot.

Definition at line 2898 of file PlotBox.java.

Color [] ptolemy.plot.PlotBox._colors [static, protected, inherited]
Initial value:
 { new Color(0xff0000), 
            new Color(0x0000ff), 
            new Color(0x00aaaa), 
            new Color(0x000000), 
            new Color(0xffa500), 
            new Color(0x53868b), 
            new Color(0xff7f50), 
            new Color(0x45ab1f), 
            new Color(0x90422d), 
            new Color(0xa0a0a0), 
            new Color(0x14ff14), 
    }

Definition at line 2949 of file PlotBox.java.

The current dataset.

Definition at line 673 of file Histogram.java.

URL ptolemy.plot.PlotBox._documentBase = null [inherited]

Indicator that size has been set.

The document base we use to find the _filespec. NOTE: Use of this variable is deprecated. But it is made available to derived classes for backward compatibility. FIXME: Sun's appletviewer gives an exception if this is protected. Why?? So we make it temporarily public.

Definition at line 2983 of file PlotBox.java.

Color ptolemy.plot.PlotBox._foreground = Color.black [protected, inherited]

Color of the foreground, settable from HTML.

Definition at line 2888 of file PlotBox.java.

boolean ptolemy.plot.PlotBox._grid = true [protected, inherited]

Whether to draw a background grid.

Definition at line 2873 of file PlotBox.java.

int ptolemy.plot.PlotBox._height = 300 [protected, inherited]

Width and height of component in pixels.

Definition at line 2966 of file PlotBox.java.

Vector ptolemy.plot.Histogram._histogram = new Vector() [protected]

A vector of histogram data.

Definition at line 679 of file Histogram.java.

int ptolemy.plot.PlotBox._leftPadding = 10 [protected, inherited]

Left padding.

Derived classes can increment these to make space around the plot.

Definition at line 2908 of file PlotBox.java.

final double ptolemy.plot.PlotBox._LOG10SCALE = 1 / Math.log(10) [static, protected, inherited]

Definition at line 2870 of file PlotBox.java.

int ptolemy.plot.PlotBox._lrx = 100 [protected, inherited]

The x value of the lower right corner of the plot rectangle in pixels.

Definition at line 2921 of file PlotBox.java.

int ptolemy.plot.PlotBox._lry = 100 [protected, inherited]

The y value of the lower right corner of the plot rectangle in pixels.

Definition at line 2925 of file PlotBox.java.

double ptolemy.plot.PlotBox._originalXhigh = 0.0 [package, inherited]

Definition at line 4014 of file PlotBox.java.

double ptolemy.plot.PlotBox._originalXlow = 0.0 [package, inherited]

Definition at line 4011 of file PlotBox.java.

Definition at line 4005 of file PlotBox.java.

double ptolemy.plot.PlotBox._originalYhigh = 0.0 [package, inherited]

Definition at line 4020 of file PlotBox.java.

double ptolemy.plot.PlotBox._originalYlow = 0.0 [package, inherited]

Definition at line 4017 of file PlotBox.java.

Definition at line 4008 of file PlotBox.java.

double ptolemy.plot.PlotBox._padding = 0.05 [protected, inherited]

The factor we pad by so that we don't plot points on the axes.

Definition at line 2810 of file PlotBox.java.

transient BufferedImage ptolemy.plot.PlotBox._plotImage = null [protected, inherited]

Definition at line 4023 of file PlotBox.java.

Vector ptolemy.plot.Histogram._points = new Vector() [protected]

A vector of datasets.

Definition at line 676 of file Histogram.java.

int ptolemy.plot.PlotBox._preferredHeight = 300 [protected, inherited]

Width and height of component in pixels.

Definition at line 2972 of file PlotBox.java.

int ptolemy.plot.PlotBox._preferredWidth = 500 [protected, inherited]

Width and height of component in pixels.

Definition at line 2969 of file PlotBox.java.

transient boolean ptolemy.plot.PlotBox._rangesGivenByZooming = false [protected, inherited]

Definition at line 2817 of file PlotBox.java.

int ptolemy.plot.PlotBox._rightPadding = 10 [protected, inherited]

Right padding.

Derived classes can increment these to make space around the plot.

Definition at line 2903 of file PlotBox.java.

Set by _drawPlot(), and reset by clear().

Definition at line 870 of file Histogram.java.

Rectangle ptolemy.plot.PlotBox._specifiedPlotRectangle = null [protected, inherited]

User specified plot rectangle, null if none specified.

See also:
setPlotRectangle(Rectangle)

Definition at line 2930 of file PlotBox.java.

int ptolemy.plot.PlotBox._topPadding = 10 [protected, inherited]

Top padding.

Derived classes can increment these to make space around the plot.

Definition at line 2893 of file PlotBox.java.

int ptolemy.plot.PlotBox._ulx = 1 [protected, inherited]

The x value of the upper left corner of the plot rectangle in pixels.

Definition at line 2914 of file PlotBox.java.

int ptolemy.plot.PlotBox._uly = 1 [protected, inherited]

The y value of the upper left corner of the plot rectangle in pixels.

Definition at line 2917 of file PlotBox.java.

boolean ptolemy.plot.PlotBox._usecolor = true [protected, inherited]

Indicator whether to use _colors.

Definition at line 2943 of file PlotBox.java.

int ptolemy.plot.PlotBox._width = 500 [protected, inherited]

Width and height of component in pixels.

Definition at line 2963 of file PlotBox.java.

boolean ptolemy.plot.PlotBox._wrap = false [protected, inherited]

Whether to wrap the X axis.

Definition at line 2876 of file PlotBox.java.

double ptolemy.plot.PlotBox._wrapHigh [protected, inherited]

The high range of the X axis for wrapping.

Definition at line 2879 of file PlotBox.java.

double ptolemy.plot.PlotBox._wrapLow [protected, inherited]

The low range of the X axis for wrapping.

Definition at line 2882 of file PlotBox.java.

double ptolemy.plot.PlotBox._xBottom = Double.MAX_VALUE [protected, inherited]

The minimum X value registered so for, for auto ranging.

Definition at line 2852 of file PlotBox.java.

double ptolemy.plot.PlotBox._xhighgiven [protected, inherited]

The given X and Y ranges.

If they have been given the top and bottom of the x and y ranges. This is different from _xMin and _xMax, which actually represent the range of data that is plotted. This represents the range specified (which may be different due to zooming).

Definition at line 2833 of file PlotBox.java.

boolean ptolemy.plot.PlotBox._xlog = false [protected, inherited]

Whether to draw the axes using a logarithmic scale.

Definition at line 2864 of file PlotBox.java.

double ptolemy.plot.PlotBox._xlowgiven [protected, inherited]

The given X and Y ranges.

If they have been given the top and bottom of the x and y ranges. This is different from _xMin and _xMax, which actually represent the range of data that is plotted. This represents the range specified (which may be different due to zooming).

Definition at line 2825 of file PlotBox.java.

transient double ptolemy.plot.PlotBox._xMax = 0 [protected, inherited]

Definition at line 2801 of file PlotBox.java.

transient double ptolemy.plot.PlotBox._xMin = 0 [protected, inherited]

Definition at line 2806 of file PlotBox.java.

transient boolean ptolemy.plot.PlotBox._xRangeGiven = false [protected, inherited]

Definition at line 2813 of file PlotBox.java.

double ptolemy.plot.PlotBox._xscale = 1.0 [protected, inherited]

Scaling used for the horizontal axis in plotting points.

The units are pixels/unit, where unit is the units of the X axis.

Definition at line 2940 of file PlotBox.java.

double ptolemy.plot.PlotBox._xTop = -Double.MAX_VALUE [protected, inherited]

The maximum X value registered so for, for auto ranging.

Definition at line 2855 of file PlotBox.java.

double ptolemy.plot.PlotBox._yBottom = Double.MAX_VALUE [protected, inherited]

The minimum Y value registered so for, for auto ranging.

Definition at line 2858 of file PlotBox.java.

double ptolemy.plot.PlotBox._yhighgiven [protected, inherited]

The given X and Y ranges.

If they have been given the top and bottom of the x and y ranges. This is different from _xMin and _xMax, which actually represent the range of data that is plotted. This represents the range specified (which may be different due to zooming).

Definition at line 2849 of file PlotBox.java.

boolean ptolemy.plot.PlotBox._ylog = false [protected, inherited]

Whether to draw the axes using a logarithmic scale.

Definition at line 2867 of file PlotBox.java.

double ptolemy.plot.PlotBox._ylowgiven [protected, inherited]

The given X and Y ranges.

If they have been given the top and bottom of the x and y ranges. This is different from _xMin and _xMax, which actually represent the range of data that is plotted. This represents the range specified (which may be different due to zooming).

Definition at line 2841 of file PlotBox.java.

transient double ptolemy.plot.PlotBox._yMax = 0 [protected, inherited]

Definition at line 2791 of file PlotBox.java.

transient double ptolemy.plot.PlotBox._yMin = 0 [protected, inherited]

Definition at line 2796 of file PlotBox.java.

transient boolean ptolemy.plot.PlotBox._yRangeGiven = false [protected, inherited]

Definition at line 2815 of file PlotBox.java.

double ptolemy.plot.PlotBox._yscale = 1.0 [protected, inherited]

Scaling used for the vertical axis in plotting points.

The units are pixels/unit, where unit is the units of the Y axis.

Definition at line 2935 of file PlotBox.java.

double ptolemy.plot.PlotBox._yTop = -Double.MAX_VALUE [protected, inherited]

The maximum Y value registered so for, for auto ranging.

Definition at line 2861 of file PlotBox.java.

final String ptolemy.plot.PlotBox.PTPLOT_RELEASE = "5.7" [static, inherited]

Definition at line 1796 of file PlotBox.java.


The documentation for this class was generated from the following file: