schmitzm.jfree.chart.style
Class ChartAxisStyle

java.lang.Object
  extended by schmitzm.jfree.chart.style.ChartLabelStyle
      extended by schmitzm.jfree.chart.style.ChartAxisStyle

public class ChartAxisStyle
extends ChartLabelStyle

This class is defines the design style of a chart Axis.

Version:
1.0
Author:
Martin Schmitz

Field Summary
protected  Double angleDegr
          Holds the angle (in degrees) the label is rotated by.
protected  String unitString
          Holds a String that reflects the values units
protected  Double valuesAngleDegr
          Holds the angle (in degrees) the axis values are rotated by.
protected  Format valuesFormat
          Holds the number format to display the axis values.
protected  boolean visible
          Holds whether the axis is visible.
 
Fields inherited from class schmitzm.jfree.chart.style.ChartLabelStyle
label, LOGGER, paint
 
Constructor Summary
ChartAxisStyle()
          Creates a new style with default values (empty label, color black, angle 0).
ChartAxisStyle(String title, Color color, Double labelAngle, Double valuesAngle)
          Creates a new style.
ChartAxisStyle(Translation title, Color color, Double labelAngle, Double valuesAngle)
          Creates a new style.
 
Method Summary
 void applyToAxis(Axis axis)
          Applies the style to a specific axis.
protected  void applyToCategoryAxis(CategoryAxis axis)
          Applies style properties which can only be applied to CategoryAxis (values angle).
protected  void applyToDateAxis(DateAxis axis)
          Applies style properties which can only be applied to DateAxis (values angle and format).
protected  void applyToNumberAxis(NumberAxis axis)
          Applies style properties which can only be applied to NumberAxis (values angle and format).
 Double getLabelAngle()
          Returns the angle (in degrees) the label text is rotated by.
 Double getLabelAngleRadian()
          Returns the angle (in radian) the label text is rotated by.
 String getUnitString()
          Returns a unit for the axis.
 Double getValuesAngle()
          Returns the angle (in degrees) the axis values are rotated by.
 double getValuesAngleRadian()
          Returns the angle (in radian) the axis values are rotated by.
 Format getValuesFormat()
          Returns the (number) format for the axis values.
 boolean isVisible()
          Returns whether the axis is visible.
 void setLabelAngle(Double angle)
          Sets the angle (in degrees) the label text is rotated by.
 void setUnitString(String unitString)
          Sets a unit for the axis.
 void setValuesAngle(Double angel)
          Sets the angle (in degrees) the label text is rotated by.
 void setValuesFormat(Format format)
          Sets the (number) format for the axis values.
 void setVisible(boolean visible)
          Sets whether the axis is visible.
 
Methods inherited from class schmitzm.jfree.chart.style.ChartLabelStyle
getLabel, getLabelTranslation, getPaint, setLabel, setLabelTranslation, setPaint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

angleDegr

protected Double angleDegr
Holds the angle (in degrees) the label is rotated by.


valuesAngleDegr

protected Double valuesAngleDegr
Holds the angle (in degrees) the axis values are rotated by.


visible

protected boolean visible
Holds whether the axis is visible.


valuesFormat

protected Format valuesFormat
Holds the number format to display the axis values.


unitString

protected String unitString
Holds a String that reflects the values units

Constructor Detail

ChartAxisStyle

public ChartAxisStyle()
Creates a new style with default values (empty label, color black, angle 0).


ChartAxisStyle

public ChartAxisStyle(String title,
                      Color color,
                      Double labelAngle,
                      Double valuesAngle)
Creates a new style.

Parameters:
title - axis title
color - text color for the axis title
labelAngle - angel (in degrees) the axis label is rotated by
valuesAngle - angel (in degrees) the axis values are rotated by

ChartAxisStyle

public ChartAxisStyle(Translation title,
                      Color color,
                      Double labelAngle,
                      Double valuesAngle)
Creates a new style.

Parameters:
title - axis title as an internationalized Translation
color - text color for the axis title
labelAngle - angel (in degrees) the axis label is rotated by
valuesAngle - angel (in degrees) the axis values are rotated by
Method Detail

getLabelAngle

public Double getLabelAngle()
Returns the angle (in degrees) the label text is rotated by.


getLabelAngleRadian

public Double getLabelAngleRadian()
Returns the angle (in radian) the label text is rotated by.


setLabelAngle

public void setLabelAngle(Double angle)
Sets the angle (in degrees) the label text is rotated by.

Parameters:
color - Color for the label text

getValuesAngle

public Double getValuesAngle()
Returns the angle (in degrees) the axis values are rotated by.


getValuesAngleRadian

public double getValuesAngleRadian()
Returns the angle (in radian) the axis values are rotated by.


setValuesAngle

public void setValuesAngle(Double angel)
Sets the angle (in degrees) the label text is rotated by.

Parameters:
color - Color for the label text

isVisible

public boolean isVisible()
Returns whether the axis is visible.


setVisible

public void setVisible(boolean visible)
Sets whether the axis is visible.


getValuesFormat

public Format getValuesFormat()
Returns the (number) format for the axis values.


setValuesFormat

public void setValuesFormat(Format format)
Sets the (number) format for the axis values.


applyToAxis

public void applyToAxis(Axis axis)
Applies the style to a specific axis.
Note: Some style properties can only be applied to specific axis types.

Parameters:
axis - an axis

applyToCategoryAxis

protected void applyToCategoryAxis(CategoryAxis axis)
Applies style properties which can only be applied to CategoryAxis (values angle).
Called by applyToAxis(Axis).

Parameters:
axis - a CategoryAxis

applyToNumberAxis

protected void applyToNumberAxis(NumberAxis axis)
Applies style properties which can only be applied to NumberAxis (values angle and format).
Called by applyToAxis(Axis).

Parameters:
axis - a NumberAxis

applyToDateAxis

protected void applyToDateAxis(DateAxis axis)
Applies style properties which can only be applied to DateAxis (values angle and format).
Called by applyToAxis(Axis).

Parameters:
axis - a DateAxis

setUnitString

public void setUnitString(String unitString)
Sets a unit for the axis.

Parameters:
unitString - a string representing the unit

getUnitString

public String getUnitString()
Returns a unit for the axis.

Parameters:
unitString - a string representing the unit