public class Plotter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Plotter.Plottable
Interface for classes which create charts capable of being plotted via
a third party rendering library to a vector based graphics format
|
Modifier and Type | Field and Description |
---|---|
static int |
DIFAX
Specifies a format of DIFAX
|
static java.lang.String[] |
FORMATS
The different file formats supported
|
static int |
JPG
Specifies a format of JPG
|
static int |
PDF
Specifies a format of PDF
|
static int |
PNG
Specifies a format of PNG
|
static int |
PS
Specifies a format of Postscript
|
static int |
SVG
Specifies a format of SVG
|
static int |
TIFF
Specifies a format of PS2
|
Constructor and Description |
---|
Plotter(int format,
java.lang.String filename)
Create a plotter
|
Plotter(int format,
java.lang.String filename,
boolean monochrome)
Create a plotter
|
Plotter(java.lang.String filename)
ctor
|
Modifier and Type | Method and Description |
---|---|
int |
getFormat()
Find out which format the plotter is plotting to
|
javax.swing.JComponent |
getPreview(Plotter.Plottable plottable)
Get the preview of the given plot
|
void |
handleError(java.lang.Exception exc)
handle the error.
|
void |
plot(Plotter.Plottable plottable)
Plot a plottable object to the file specified in the constructor
|
void |
setColourDepth(int colourDepth)
Set color depth
|
void |
setFilename(java.lang.String filename)
Set the filename
|
void |
setMonochrome(boolean monochrome)
set monochrome
|
public static final int SVG
public static final int PNG
public static final int JPG
public static final int PS
public static final int PDF
public static final int TIFF
public static final int DIFAX
public static final java.lang.String[] FORMATS
public Plotter(int format, java.lang.String filename)
format
- The format of the distination file SVG, PNG or PSfilename
- The filename to plot topublic Plotter(java.lang.String filename)
filename
- file to write topublic Plotter(int format, java.lang.String filename, boolean monochrome)
format
- The format of the distination file SVG, PNG or PSfilename
- The filename to plot tomonochrome
- Set to true if all colours are to be plotted as
either pure black or pure whitepublic void handleError(java.lang.Exception exc) throws java.lang.Exception
exc
- The error.java.lang.Exception
- On badnesspublic void setFilename(java.lang.String filename)
filename
- the filenamepublic void setMonochrome(boolean monochrome)
monochrome
- is monochromepublic void setColourDepth(int colourDepth)
colourDepth
- the depthpublic int getFormat()
public void plot(Plotter.Plottable plottable) throws java.io.FileNotFoundException, java.io.IOException, java.lang.Exception
plottable
- The object to be plottedjava.lang.Exception
- On badnessjava.io.FileNotFoundException
- On badnessjava.io.IOException
- On badnesspublic javax.swing.JComponent getPreview(Plotter.Plottable plottable) throws java.io.FileNotFoundException, java.io.IOException
plottable
- plot to previewjava.io.FileNotFoundException
- On badnessjava.io.IOException
- On badness