|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.northwestern.at.utils.plots.Plots
public class Plots
Plot utilities.
This static class provides various utility methods for generating plots and charts.
Field Summary | |
---|---|
protected static FileExtensionFilter |
jpegFilter
JPEG extensions file filter. |
protected static FileExtensionFilter |
pngFilter
PNG extension file filter. |
protected static FileExtensionFilter |
svgFilter
SVG extension file filter. |
Constructor Summary | |
---|---|
protected |
Plots()
Don't allow instantiation, do allow overrides. |
Method Summary | |
---|---|
static BarChartPanel |
barChart(double[] barData,
double[] barValues,
int width,
int height,
java.lang.String title,
java.lang.String xTitle,
java.lang.String yTitle,
java.lang.String legendLabel,
boolean horizontal,
boolean showBarValues)
Generate a bar chart in a JPanel. |
static BarChartPanel |
barChart(java.lang.String[] barLabels,
double[] barValues,
int width,
int height,
java.lang.String title,
java.lang.String xTitle,
java.lang.String yTitle,
java.lang.String legendLabel,
boolean horizontal,
boolean showBarValues)
Generate a bar chart. |
static org.krysalis.jcharts.properties.ChartTypeProperties |
getChartTypeProperties(int numberOfDataSets)
Generate default line plot strokes and shapes. |
static void |
linePlot(javax.swing.JPanel panel,
double[] xData,
double[] yData,
int width,
int height,
java.lang.String title,
java.lang.String xTitle,
java.lang.String yTitle)
Generate a line plot in a JPanel. |
static void |
saveChartToFile(org.krysalis.jcharts.Chart chart,
java.lang.String fileName)
Saves the chart to a file. |
static void |
saveChartToFile(java.awt.Window parentWindow,
org.krysalis.jcharts.Chart chart)
Saves the chart to a file. |
static void |
saveChartToFileAsJPEG(org.krysalis.jcharts.Chart chart,
java.lang.String fileName)
Saves the chart to a file in JPEG format. |
static void |
saveChartToFileAsJPEG(org.krysalis.jcharts.Chart chart,
java.lang.String fileName,
float quality)
Saves the chart to a file in JPEG format. |
static void |
saveChartToFileAsPNG(org.krysalis.jcharts.Chart chart,
java.lang.String fileName)
Saves the chart to a file in PNG format. |
static void |
saveChartToFileAsSVG(org.krysalis.jcharts.Chart chart,
java.lang.String fileName)
Saves the chart to a file in SVG format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static FileExtensionFilter jpegFilter
protected static FileExtensionFilter pngFilter
protected static FileExtensionFilter svgFilter
Constructor Detail |
---|
protected Plots()
Method Detail |
---|
public static void linePlot(javax.swing.JPanel panel, double[] xData, double[] yData, int width, int height, java.lang.String title, java.lang.String xTitle, java.lang.String yTitle)
panel
- JPanel into which to drop plot.xData
- double array of x-axis data.yData
- double array of y-axis data.width
- width of bar chart (pixels).height
- height of bar chart (pixels).title
- plot title.xTitle
- x-axis title.yTitle
- y-axis title. public static BarChartPanel barChart(java.lang.String[] barLabels, double[] barValues, int width, int height, java.lang.String title, java.lang.String xTitle, java.lang.String yTitle, java.lang.String legendLabel, boolean horizontal, boolean showBarValues)
barLabels
- labels for x-axis.barValues
- double array of y-axis data.width
- width of bar chart (pixels).height
- height of bar chart (pixels).title
- plot title.xTitle
- x-axis title.yTitle
- y-axis title.horizontal
- true to display horizontal bar chart.showBarValues
- true to display bar values in bar.
public static BarChartPanel barChart(double[] barData, double[] barValues, int width, int height, java.lang.String title, java.lang.String xTitle, java.lang.String yTitle, java.lang.String legendLabel, boolean horizontal, boolean showBarValues)
barData
- double array of x-axis data.barValues
- double array of y-axis data.width
- width of bar chart (pixels).height
- height of bar chart (pixels).title
- plot title.xTitle
- x-axis title.yTitle
- y-axis title.horizontal
- true to display horizontal bar chart.showBarValues
- true to display bar values in bar.
public static org.krysalis.jcharts.properties.ChartTypeProperties getChartTypeProperties(int numberOfDataSets)
numberOfDataSets
- Number of data sets in plot. public static void saveChartToFileAsJPEG(org.krysalis.jcharts.Chart chart, java.lang.String fileName, float quality)
chart
- The chart to save.fileName
- The file name to which to save the plot.quality
- Number between 0.0 and 1.0 indicating
compression quality. public static void saveChartToFileAsJPEG(org.krysalis.jcharts.Chart chart, java.lang.String fileName)
chart
- The chart to save.fileName
- The file name to which to save the plot.
The JPEG compression quality is set to 1.0f .
public static void saveChartToFileAsPNG(org.krysalis.jcharts.Chart chart, java.lang.String fileName)
chart
- The chart to save.fileName
- The file name to which to save the plot. public static void saveChartToFileAsSVG(org.krysalis.jcharts.Chart chart, java.lang.String fileName)
chart
- The chart to save.fileName
- The file name to which to save the plot. public static void saveChartToFile(org.krysalis.jcharts.Chart chart, java.lang.String fileName)
chart
- The chart to save.fileName
- The file name to which to save the plot.
The filename extension determines the type of output. .jpg -> jpeg, .png -> png, .svg -> svg. If the filename does not end in one of these, no file is written.
public static void saveChartToFile(java.awt.Window parentWindow, org.krysalis.jcharts.Chart chart)
parentWindow
- Parent window for file dialog.chart
- The chart to save.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |