|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectschmitzm.jfree.JFreeChartUtil
public class JFreeChartUtil
In dieser Klasse sind Hilfsmethoden fuer JFreeChart hinterlegt.
Field Summary | |
---|---|
static ChartStyleXMLFactory<ChartStyle> |
CHART_STYLE_FACTORY
Instance of ChartStyleXMLFactory . |
static Double |
DEFAULT_CENTRATION_BOUNDARY_PCT
Default percentage, an (axis) range is extended with on centering to avoid points directly on the plot border. |
static ResourceProvider |
RESOURCE
ResourceProvider , der die Lokalisation fuer GUI-Komponenten zur
Verfuegung stellt. |
Constructor Summary | |
---|---|
JFreeChartUtil()
|
Method Summary | |
---|---|
static void |
addRegressionLineToPlot(XYPlot plot,
XYDataset regressionData,
Color lineColor)
Adds a line plot for regression data to a plot. |
static void |
applyDatasetProperties(Dataset dataset,
Dataset sample)
Applies general dataset properties to a Dataset . |
static Range |
centerRange(Range range,
Double boundaryPct)
Returns a new centered Range defined as [-maxAbs; maxAbs] of a
given Range . |
static CategoryItemRenderer |
createCategoryRenderer(BasicChartStyle style)
Creates a CategoryItemRenderer for the given stepped and stacked
properties. |
static CategoryItemRenderer |
createCategoryRenderer(ChartType type,
boolean stepped,
boolean stacked)
Creates a CategoryItemRenderer for the given stepped and stacked
properties. |
static JFreeChart |
createRegressionChart(XYDataset dataset,
String title,
String xAxisTitle,
String yAxisTitle,
boolean regressionLine)
Creates a JFreeChart which shows a point for each data item and a
the appropriate regression line. |
static XYDataset |
createRegressionLineDataset(XYDataset dataset,
int series,
String seriesKey,
double startX,
double endX,
int sampleCount)
Creates sample data for a regression line of an XYDataset . |
static XYDataset |
createRegressionLineDataset(XYSeriesCollection dataset,
int series,
String seriesKey,
int sampleCount)
Creates sample data for a regression line of an XYDataset . |
static XYItemRenderer |
createXYRenderer(BasicChartStyle style)
Creates a XYItemRenderer for the given stepped and stacked
properties. |
static XYItemRenderer |
createXYRenderer(ChartType type,
boolean stepped,
boolean stacked)
Creates a XYItemRenderer for the given stepped and stacked
properties. |
static void |
fireChangeEvent(AbstractRenderer renderer)
Fires a change event to all RendererChangeListener connected to
the renderer. |
static void |
fireChangeEvent(Plot plot)
Fires a change event to all PlotChangeListener connected to the
plot. |
static double |
getAbsRange(Range range,
Double boundaryPct)
Returns the maximum extend of a Range including a given boundary. |
static Dataset |
getDatasetForRenderer(Plot plot,
Object renderer)
Returns the (first) dataset of a Plot which is rendererd by a
renderer. |
static Object |
getRendererForDataset(Plot plot,
int i)
Returns the renderer for the i -th dataset of a plot. |
static DatasetSelectionModel<?,?,?> |
getSelectionModelForDataset(Plot plot,
Dataset dataset)
Searchs the renderers of a plot for SelectionRenderer for a
Dataset and returns its DatasetSelectionModel . |
static Map<Integer,DatasetSelectionModel<?,?,?>> |
getSelectionModels(Plot plot)
Searchs the renderers of a plot for all SelectionRenderer and
returns their DatasetSelectionModels . |
static Map<Integer,SelectionRenderer<?>> |
getSelectionRenderer(Plot plot)
Returns all SelectionRenderer for a Plot . |
static SelectionRenderer<?> |
getSelectionRendererForDataset(Plot plot,
Dataset dataset)
Searchs the renderers of a plot for SelectionRenderer for a
Dataset . |
static String |
R(String key,
Object... values)
Convenience method to access the ResourceProvider . |
static void |
setLegendVisible(JFreeChart chart,
boolean visible)
Sets all chart legends (in)visible. |
static void |
zoomAxisToFullExtend(ValueAxis axis,
Double boundaryPct,
boolean symmetric)
Centers a gives Axis around 0 (if normalized) or around it's
center. |
static void |
zoomPlotToFullExtend(Plot plot,
Double boundaryPct,
boolean symetric)
Centers a gives Plot . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Double DEFAULT_CENTRATION_BOUNDARY_PCT
public static ResourceProvider RESOURCE
ResourceProvider
, der die Lokalisation fuer GUI-Komponenten zur
Verfuegung stellt. Diese sind in properties-Datein unter schmitzm.jfree.resource.locales.JFreeResourceBundle_XXX.properties
hinterlegt.
public static final ChartStyleXMLFactory<ChartStyle> CHART_STYLE_FACTORY
ChartStyleXMLFactory
.
Constructor Detail |
---|
public JFreeChartUtil()
Method Detail |
---|
public static String R(String key, Object... values)
ResourceProvider
.
public static void setLegendVisible(JFreeChart chart, boolean visible)
chart
- a chart to applyvisible
- indicates the visible propertypublic static void fireChangeEvent(Plot plot)
PlotChangeListener
connected to the
plot.
plot
- a plotpublic static void fireChangeEvent(AbstractRenderer renderer)
RendererChangeListener
connected to
the renderer.
renderer
- a rendererpublic static double getAbsRange(Range range, Double boundaryPct)
Range
including a given boundary.
range
- a Range
boundaryPct
- extends the Range
bound by percentage (if null
is used).
public static Range centerRange(Range range, Double boundaryPct)
Range
defined as [-maxAbs; maxAbs] of a
given Range
.
range
- the Range
to centerboundaryPct
- extends the range's absolute maximum by percentage (if null
is used).
Range
objectpublic static void zoomAxisToFullExtend(ValueAxis axis, Double boundaryPct, boolean symmetric)
Axis
around 0 (if normalized) or around it's
center.
axis
- the Axis
to centerboundaryPct
- extends the axis range's absolute maximum by percentage (if
null
is
used).symmetric
- If true
the axis is centered symetricallypublic static void zoomPlotToFullExtend(Plot plot, Double boundaryPct, boolean symetric)
Plot
. For
CategoryPlot
only the range axis is centered.
axis
- the Plot
to centerboundaryPct
- percentage boundary the absolute maximum is extended withsymetric
- If true
the axis is centered symmetrically around it medium.public static XYItemRenderer createXYRenderer(BasicChartStyle style)
XYItemRenderer
for the given stepped and stacked
properties.
type
- chart typestepped
- stepped propertystacked
- stacked propertypublic static XYItemRenderer createXYRenderer(ChartType type, boolean stepped, boolean stacked)
XYItemRenderer
for the given stepped and stacked
properties.
type
- chart typestepped
- stepped propertystacked
- stacked propertypublic static CategoryItemRenderer createCategoryRenderer(BasicChartStyle style)
CategoryItemRenderer
for the given stepped and stacked
properties.
type
- chart typestepped
- stepped propertystacked
- stacked propertypublic static CategoryItemRenderer createCategoryRenderer(ChartType type, boolean stepped, boolean stacked)
CategoryItemRenderer
for the given stepped and stacked
properties.
type
- chart typestepped
- stepped propertystacked
- stacked propertypublic static Object getRendererForDataset(Plot plot, int i)
i
-th dataset of a plot.
plot
- a plotindex
- the dataset index
i
public static SelectionRenderer<?> getSelectionRendererForDataset(Plot plot, Dataset dataset)
SelectionRenderer
for a
Dataset
.
plot
- the plot to check for rendererdataset
- the dataset a SelectionRenderer
is searched for
null
if there is no SelectionRenderer
defined for
the datasetpublic static DatasetSelectionModel<?,?,?> getSelectionModelForDataset(Plot plot, Dataset dataset)
SelectionRenderer
for a
Dataset
and returns its DatasetSelectionModel
.
plot
- the plot to check for rendererdataset
- the dataset a SelectionRenderer
is searched for
null
if there is no SelectionRenderer
defined for
the datasetpublic static Map<Integer,SelectionRenderer<?>> getSelectionRenderer(Plot plot)
SelectionRenderer
for a Plot
.
plot
- the plot to check for renderer
null
public static Map<Integer,DatasetSelectionModel<?,?,?>> getSelectionModels(Plot plot)
SelectionRenderer
and
returns their DatasetSelectionModels
.
plot
- the plot to check for renderer
null
public static Dataset getDatasetForRenderer(Plot plot, Object renderer)
Plot
which is rendererd by a
renderer.
plot
- the plot which holds the datasets and rendererrenderer
- the renderer a dataset is seached for
null
if there is no dataset which is rendered by the
given rendererpublic static void applyDatasetProperties(Dataset dataset, Dataset sample)
Dataset
.
dataset
- dataset the properties are applied tosample
- dataset the properties are taken frompublic static JFreeChart createRegressionChart(XYDataset dataset, String title, String xAxisTitle, String yAxisTitle, boolean regressionLine)
JFreeChart
which shows a point for each data item and a
the appropriate regression line.
dataset
- the datatitle
- title for the chartxAxisTitle
- title for the X-AxisyAxisTitle
- title for the Y-AxisregressionLine
- indicates whether the regression line is shownpublic static XYDataset createRegressionLineDataset(XYSeriesCollection dataset, int series, String seriesKey, int sampleCount)
XYDataset
.
dataset
- data the regression line is created forseries
- series of dataset
the regression line is created forseriesKey
- the key for the created datasetsampleCnt
- count of created samplespublic static XYDataset createRegressionLineDataset(XYDataset dataset, int series, String seriesKey, double startX, double endX, int sampleCount)
XYDataset
.
dataset
- data the regression line is created forseries
- series of dataset
the regression line is created forseriesKey
- the key for the created datasetstartX
- the first value the sample data is created forendX
- the last value the sample data is created forsampleCnt
- count of created samples
null
if the regression data could not be created (because
of an errorpublic static void addRegressionLineToPlot(XYPlot plot, XYDataset regressionData, Color lineColor)
plot
- the plot the line is added to (at the end)regressionData
- the regression datalineColor
- the color for the regression line
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |