schmitzm.jfree.chart.style
Interface ChartStyle

All Known Subinterfaces:
FeatureChartStyle
All Known Implementing Classes:
AbstractChartStyle, BasicChartStyle, FeatureBasicChartStyle, FeatureChartStyle.Dummy, FeatureScatterChartStyle, ScatterChartStyle

public interface ChartStyle

This interface is a general super class for a design style of a JFreeChart. Sub classes should read the style from an xml element or something like that. Maybe there could be a general implementation representing a style for basic charts (bar, line and area charts) and special implementations for special chart types (e.g. financial, statistical oder spider charts).

Version:
1.0
Author:
Martin Schmitz

Field Summary
static int DOMAIN_AXIS
          Constant for the domain axis (X).
static Logger LOGGER
           
static int RANGE_AXIS
          Constant for the range axis (Y).
static int RANGE_AXIS2
          Constant for the second range axis (Y).
static int X_AXIS
          Constant for the domain axis (X).
static int Y_AXIS
          Constant for the range axis (Y).
static int Y_AXIS_LEFT
          Constant for the range axis (Y).
static int Y_AXIS_RIGHT
          Constant for the second range axis (Y).
static int Y_AXIS2
          Constant for the second range axis (Y).
 
Method Summary
 void applyToChart(JFreeChart chart)
          Applies the style to an existing chart.
 JFreeChart applyToDataset(Dataset dataset)
          Generates a chart using the given data and the style represented by this class.
 int getAxisCount()
          Returns count of axis of the chart.
 ChartAxisStyle getAxisStyle(int axis)
          Returns the style of a chart axis.
 Color getBackground()
          Returns the background color of the chart.
 ChartLabelStyle getDescStyle()
          Returns the style of the long chart description.
 String getID()
          Returns an (unique) ID for the style.
 PlotOrientation getOrientation()
          Returns the orientation of the chart.
 ChartPlotStyle getPlotStyle()
          Returns the style of the chart's plot.
 int getRendererCount()
          Returns count of renderer for the chart.
 ChartRendererStyle getRendererStyle(int dataset)
          Returns the style of a dataset renderer.
 ChartLabelStyle getTitleStyle()
          Returns the style of the chart title.
 ChartType getType()
          Returns the type of the chart style.
 boolean hasLegend()
          Returns whether the chart is configured to generate a legend.
 boolean hasTooltips()
          Returns whether the chart is configured to generate tooltips for the data.
 boolean hasURLs()
          Returns whether the chart is configured to generate URLs.
 boolean isBorderVisible()
          Returns whether a border is shown around the whole chart.
 void setAxisStyle(int axis, ChartAxisStyle style)
          Sets the style of a chart axis.
 void setBackground(Color paint)
          Sets the background color of the chart.
 void setBorderVisible(boolean visible)
          Sets whether a border is shown around the whole chart.
 void setDescStyle(ChartLabelStyle descStyle)
          Sets the long description for the chart.
 void setLegend(boolean legend)
          Sets whether the chart is configured to generate a legend.
 void setOrientation(PlotOrientation orientation)
          Sets the orientation of the chart.
 void setPlotStyle(ChartPlotStyle style)
          Sets the style of the chart's plot.
 void setRendererStyle(int dataset, ChartRendererStyle style)
          Sets the style of a dataset renderer.
 void setTitleStyle(ChartLabelStyle titleStyle)
          Sets the title for the chart.
 void setTooltips(boolean tooltips)
          Sets whether the chart is configured to generate tooltips for the data.
 void setURLs(boolean urls)
          Sets whether the chart is configured to generate URLs.
 

Field Detail

LOGGER

static final Logger LOGGER

DOMAIN_AXIS

static final int DOMAIN_AXIS
Constant for the domain axis (X).

See Also:
Constant Field Values

X_AXIS

static final int X_AXIS
Constant for the domain axis (X). Synonym for DOMAIN_AXIS.

See Also:
Constant Field Values

RANGE_AXIS

static final int RANGE_AXIS
Constant for the range axis (Y).

See Also:
Constant Field Values

Y_AXIS

static final int Y_AXIS
Constant for the range axis (Y). Synonym for RANGE_AXIS.

See Also:
Constant Field Values

Y_AXIS_LEFT

static final int Y_AXIS_LEFT
Constant for the range axis (Y). Synonym for RANGE_AXIS.

See Also:
Constant Field Values

RANGE_AXIS2

static final int RANGE_AXIS2
Constant for the second range axis (Y).

See Also:
Constant Field Values

Y_AXIS2

static final int Y_AXIS2
Constant for the second range axis (Y). Synonym for RANGE_AXIS2.

See Also:
Constant Field Values

Y_AXIS_RIGHT

static final int Y_AXIS_RIGHT
Constant for the second range axis (Y). Synonym for RANGE_AXIS2.

See Also:
Constant Field Values
Method Detail

getID

String getID()
Returns an (unique) ID for the style.


getType

ChartType getType()
Returns the type of the chart style.


getOrientation

PlotOrientation getOrientation()
Returns the orientation of the chart.

See Also:
PlotOrientation#HORIZONTAL, PlotOrientation#VERTICAL

setOrientation

void setOrientation(PlotOrientation orientation)
Sets the orientation of the chart.

Parameters:
orientation - the orientation of the chart

getTitleStyle

ChartLabelStyle getTitleStyle()
Returns the style of the chart title. Should never return null!!


setTitleStyle

void setTitleStyle(ChartLabelStyle titleStyle)
Sets the title for the chart.

Parameters:
titleStyle - the new chart title style

getDescStyle

ChartLabelStyle getDescStyle()
Returns the style of the long chart description.


setDescStyle

void setDescStyle(ChartLabelStyle descStyle)
Sets the long description for the chart.

Parameters:
descStyle - the new chart description style

getBackground

Color getBackground()
Returns the background color of the chart.


setBackground

void setBackground(Color paint)
Sets the background color of the chart.

Parameters:
paint - the background color for the chart

isBorderVisible

boolean isBorderVisible()
Returns whether a border is shown around the whole chart.


setBorderVisible

void setBorderVisible(boolean visible)
Sets whether a border is shown around the whole chart.


hasLegend

boolean hasLegend()
Returns whether the chart is configured to generate a legend.


setLegend

void setLegend(boolean legend)
Sets whether the chart is configured to generate a legend.


hasTooltips

boolean hasTooltips()
Returns whether the chart is configured to generate tooltips for the data.


setTooltips

void setTooltips(boolean tooltips)
Sets whether the chart is configured to generate tooltips for the data.


hasURLs

boolean hasURLs()
Returns whether the chart is configured to generate URLs.


setURLs

void setURLs(boolean urls)
Sets whether the chart is configured to generate URLs.


getAxisCount

int getAxisCount()
Returns count of axis of the chart.


getAxisStyle

ChartAxisStyle getAxisStyle(int axis)
Returns the style of a chart axis.
0 = domain axis (X)
1 = first (left) range axis (Y)
2 = second (right) range axis (Y) if available

Returns:
null if axis style is not available

setAxisStyle

void setAxisStyle(int axis,
                  ChartAxisStyle style)
Sets the style of a chart axis.

Parameters:
axis - axis number (0=domain, 1=range, ...)
style - style for the axis

getRendererCount

int getRendererCount()
Returns count of renderer for the chart.


getRendererStyle

ChartRendererStyle getRendererStyle(int dataset)
Returns the style of a dataset renderer.

Parameters:
dataset - dataset number (starting with 0)
Returns:
null if the chart has no such renderer

setRendererStyle

void setRendererStyle(int dataset,
                      ChartRendererStyle style)
Sets the style of a dataset renderer.

Parameters:
dataset - dataset number (starting with 0)
style - style for the axis

getPlotStyle

ChartPlotStyle getPlotStyle()
Returns the style of the chart's plot.

Returns:
null if no such style is defined

setPlotStyle

void setPlotStyle(ChartPlotStyle style)
Sets the style of the chart's plot.

Parameters:
style - style for the plot

applyToChart

void applyToChart(JFreeChart chart)
Applies the style to an existing chart.

Parameters:
chart - chart to be styled
Throws:
UnsupportedOperationException - if the style can not be applied to the given chart

applyToDataset

JFreeChart applyToDataset(Dataset dataset)
Generates a chart using the given data and the style represented by this class.

Parameters:
dataset - the data for the chart
Throws:
UnsupportedOperationException - if the style can not be applied to the given dataset