com.approximatrix.charting.coordsystem
Interface CoordSystem

All Superinterfaces:
Renderer
All Known Implementing Classes:
AbstractCoordSystem, BoxCoordSystem, ClassicCoordSystem, CoordSystem, InvisibleCoordSystem

public interface CoordSystem
extends Renderer

Interface defining a Coordinate System object that both provides calculation functionality for determining data-space to graphics-space transformation as well as actual rendering of axes and tick marks.

Author:
jarmstrong

Field Summary
static int FIRST_YAXIS
          the axis binding constant for the first y-axis
static int SECOND_YAXIS
          the axis binding constant for the second y-axis
 
Method Summary
 void chartDataChanged(ChartDataModelEvent evt)
          Listener to force the recomputation of all transforms on data changes
 ChartDataModelConstraints getChartDataModelConstraints(int axis)
          Returns the used ChartDataModelConstraints.
 java.awt.geom.AffineTransform getDefaultTransform(int axis)
          This method computes the default transform which transforms the user space coordinates of this coordinate system to the pixel space coordinates used in the Graphics object.
 Axis getFirstYAxis()
          Returns the first y-axis.
 java.awt.Font getFont()
          Deprecated. deprecated in version 1.4 - use getTickFont()
 java.awt.Rectangle getInnerBounds()
          Returns the inner margin, ie the bounds minus the margins.
 int getMaximumXTicks()
          Returns the maximum number of X ticks to draw on the X axis
 int getMaximumYTicks()
          Returns the maximum number of Y ticks to draw on the Y axis
 boolean getPaintGrid()
          Returns whether a grid is painted.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size needed for the renderer.
 Axis getSecondYAxis()
          Returns the second y-axis.
 java.awt.Font getTickFont()
          Returns the font used for the axis tick labels.
 java.awt.geom.AffineTransform getTransform(int axis)
          Returns the currently defined AffineTransform for any y-axis.
 java.awt.Font getUnitFont()
          Returns the font used for the axis unit labels.
 Axis getXAxis()
          Returns the x axis.
 java.lang.String getXAxisUnit()
          Gets the x-axis unit string.
 java.text.DecimalFormat getXDecimalFormat()
          Returns the DecimalFormat used on the Xaxis
 java.lang.String getYAxisUnit()
          Gets the y-axis label.
 java.text.DecimalFormat getYDecimalFormat()
          Returns the DecimalFormat used on the Yaxis
 boolean isCenterLabelsBetweenTicks()
          Returns true if labels are centered between ticks.
 boolean isPaintAxes()
          Returns whether axes will be painted.
 boolean isPaintGrid()
          if true, a grid will be painted on the chart
 boolean isPaintLabels()
          if true, labels will be painted for each axis
 boolean isPaintOnlyTick()
          Deprecated. deprecated as of version 1.4
 void paintDefault(java.awt.Graphics2D g)
          This method is called by the paint method to do the actual painting.
 void render(java.awt.Graphics2D g)
          Overrides the method to just call paintDefault.
 void resetMaximumXTicks()
          Resets the maximum number of ticks along the X axis to the default value
 void resetMaximumYTicks()
          Resets the maximum number of ticks along the X axis to the default value
 void setBounds(java.awt.Rectangle bounds)
          Computes all margins, initializes the length of the Axis and calls super.setBounds.
 void setCenterLabelsBetweenTicks(boolean value)
          Forces the coordinate system to place the label centered between tick marks (for bar charts for example).
 void setFirstYAxis(Axis a)
          Sets the left y-axis and computes the matrix transformation.
 void setFont(java.awt.Font f)
          Deprecated. deprecated in version 1.4 - use setTickFont()
 void setMaximumXTicks(int value)
          Sets the maximum number of ticks along the X axis that will be allowed.
 void setMaximumYTicks(int value)
          Sets the maximum number of ticks along the Y axis that will be allowed.
 void setPaintAxes(boolean axes)
          Sets whether the axes will be painted.
 void setPaintGrid(boolean value)
          Sets whether a grid is painted.
 void setPaintLabels(boolean label)
          Sets whether labels should be painted for the axes
 void setSecondYAxis(Axis a)
          Sets the second y-axis and computes the matrix transformation.
 void setTickFont(java.awt.Font f)
          Sets the font for the axis tick labels.
 void setTransform(java.awt.geom.AffineTransform at, int axis)
          Sets the coordinate transformation for any y-coordinate.
 void setUnitFont(java.awt.Font f)
          Sets the font for the axis unit labels.
 void setXAxis(Axis a)
          Sets the x-axis.
 void setXAxisUnit(java.lang.String xunit)
          Sets the x-axis unit string.
 void setXDecimalFormat(java.text.DecimalFormat df)
          Returns the DecimalFormat used on the Xaxis
 void setYAxisUnit(java.lang.String yunit)
          Sets the y-axis unit string.
 void setYDecimalFormat(java.text.DecimalFormat df)
          Returns the DecimalFormat used on the Yaxis
 
Methods inherited from interface com.approximatrix.charting.render.Renderer
addRenderChangeListener, clearRenderChangeListeners, fireRenderChangeEvent, getBounds, removeRenderChangeListener
 

Field Detail

FIRST_YAXIS

static final int FIRST_YAXIS
the axis binding constant for the first y-axis

See Also:
Constant Field Values

SECOND_YAXIS

static final int SECOND_YAXIS
the axis binding constant for the second y-axis

See Also:
Constant Field Values
Method Detail

setPaintGrid

void setPaintGrid(boolean value)
Sets whether a grid is painted.

Parameters:
value - whether the grid should be painted

getPaintGrid

boolean getPaintGrid()
Returns whether a grid is painted.


setXAxis

void setXAxis(Axis a)
Sets the x-axis.

Parameters:
a - the x-axis

getXAxis

Axis getXAxis()
Returns the x axis.

Returns:
the x-axis

setXAxisUnit

void setXAxisUnit(java.lang.String xunit)
Sets the x-axis unit string.

Parameters:
xtext - the unit string

getXAxisUnit

java.lang.String getXAxisUnit()
Gets the x-axis unit string.

Returns:
the label String

setYAxisUnit

void setYAxisUnit(java.lang.String yunit)
Sets the y-axis unit string.

Parameters:
ytext - the unit string

getYAxisUnit

java.lang.String getYAxisUnit()
Gets the y-axis label.

Returns:
the label String

setFont

void setFont(java.awt.Font f)
Deprecated. deprecated in version 1.4 - use setTickFont()

Sets the font for the axis tick labels.

Parameters:
f - the Font to be used

getFont

java.awt.Font getFont()
Deprecated. deprecated in version 1.4 - use getTickFont()

Returns the font used for the axis tick labels.

Returns:
the Font object

setTickFont

void setTickFont(java.awt.Font f)
Sets the font for the axis tick labels.

Parameters:
f - the Font to be used

getTickFont

java.awt.Font getTickFont()
Returns the font used for the axis tick labels.

Returns:
the Font object

setUnitFont

void setUnitFont(java.awt.Font f)
Sets the font for the axis unit labels.

Parameters:
f - the Font to be used

getUnitFont

java.awt.Font getUnitFont()
Returns the font used for the axis unit labels.

Returns:
the Font object

setFirstYAxis

void setFirstYAxis(Axis a)
Sets the left y-axis and computes the matrix transformation.

Parameters:
a - the left y-axis

getFirstYAxis

Axis getFirstYAxis()
Returns the first y-axis.

Returns:
the left y-axis

setSecondYAxis

void setSecondYAxis(Axis a)
Sets the second y-axis and computes the matrix transformation.

Parameters:
a - the right y-axis

getSecondYAxis

Axis getSecondYAxis()
Returns the second y-axis.

Returns:
the right y-axis

getInnerBounds

java.awt.Rectangle getInnerBounds()
Returns the inner margin, ie the bounds minus the margins.

Returns:
a Rectangle object defining the inner bounds.

setBounds

void setBounds(java.awt.Rectangle bounds)
Computes all margins, initializes the length of the Axis and calls super.setBounds. Additionally, it sets the default AffineTransforms for every y-axis.

Specified by:
setBounds in interface Renderer
Parameters:
bounds - Rectangle object defining the bounds

getPreferredSize

java.awt.Dimension getPreferredSize()
Returns the preferred size needed for the renderer.

Specified by:
getPreferredSize in interface Renderer
Returns:
a Dimension with the minimum Integer values.

render

void render(java.awt.Graphics2D g)
Overrides the method to just call paintDefault.

Specified by:
render in interface Renderer
Parameters:
g - the Graphics2D object to paint in

paintDefault

void paintDefault(java.awt.Graphics2D g)
This method is called by the paint method to do the actual painting. The painting is supposed to start at point (0,0) and the size is always the same as the preferred size. The paint method performs the possible scaling.

Parameters:
g - the Graphics2D object to paint in

getYDecimalFormat

java.text.DecimalFormat getYDecimalFormat()
Returns the DecimalFormat used on the Yaxis


getXDecimalFormat

java.text.DecimalFormat getXDecimalFormat()
Returns the DecimalFormat used on the Xaxis


setYDecimalFormat

void setYDecimalFormat(java.text.DecimalFormat df)
Returns the DecimalFormat used on the Yaxis


setXDecimalFormat

void setXDecimalFormat(java.text.DecimalFormat df)
Returns the DecimalFormat used on the Xaxis


isPaintOnlyTick

boolean isPaintOnlyTick()
Deprecated. deprecated as of version 1.4

if true only the tick will be painted on the yaxis. Alternately a light grey line will paint across the background of the chart.


isPaintLabels

boolean isPaintLabels()
if true, labels will be painted for each axis

Returns:
true if labels will be painted, false otherwise

isPaintGrid

boolean isPaintGrid()
if true, a grid will be painted on the chart

Returns:
true if grid will be painted, false otherwise

setPaintLabels

void setPaintLabels(boolean label)
Sets whether labels should be painted for the axes

Parameters:
label - true to paint labels, false otherwise

isPaintAxes

boolean isPaintAxes()
Returns whether axes will be painted. If true, the axes, at minimum, will be painted. If false, all ClassicCoordSystem painting is skipped regardless of other settings.

Returns:
true if axes are to be painted, false otherwise

setPaintAxes

void setPaintAxes(boolean axes)
Sets whether the axes will be painted. If set to false, the ClassicCoordSystem object will perform no painting whatsoever, regardless of other settings.

Parameters:
axes - true to paint axes, false otherwise

setMaximumXTicks

void setMaximumXTicks(int value)
Sets the maximum number of ticks along the X axis that will be allowed.

Parameters:
value - the maximum number of X ticks, or -1 to reset to default

setMaximumYTicks

void setMaximumYTicks(int value)
Sets the maximum number of ticks along the Y axis that will be allowed.

Parameters:
value - the maximum number of Y ticks, or -1 to reset to default

getMaximumXTicks

int getMaximumXTicks()
Returns the maximum number of X ticks to draw on the X axis

Returns:
the maximum number of X ticks to draw

getMaximumYTicks

int getMaximumYTicks()
Returns the maximum number of Y ticks to draw on the Y axis

Returns:
the maximum number of Y ticks to draw

resetMaximumXTicks

void resetMaximumXTicks()
Resets the maximum number of ticks along the X axis to the default value


resetMaximumYTicks

void resetMaximumYTicks()
Resets the maximum number of ticks along the X axis to the default value


setTransform

void setTransform(java.awt.geom.AffineTransform at,
                  int axis)
Sets the coordinate transformation for any y-coordinate.

Parameters:
at - the AffineTransform that transforms the coordinates into pixel space

getTransform

java.awt.geom.AffineTransform getTransform(int axis)
Returns the currently defined AffineTransform for any y-axis.

Parameters:
axis - the y-axis to be used.

getDefaultTransform

java.awt.geom.AffineTransform getDefaultTransform(int axis)
This method computes the default transform which transforms the user space coordinates of this coordinate system to the pixel space coordinates used in the Graphics object. All rendering in the CoordinateSystem and the ChartRenderers will rely on this transform.

Parameters:
axis - defines which y-axis to use.

getChartDataModelConstraints

ChartDataModelConstraints getChartDataModelConstraints(int axis)
Returns the used ChartDataModelConstraints.


chartDataChanged

void chartDataChanged(ChartDataModelEvent evt)
Listener to force the recomputation of all transforms on data changes

Parameters:
evt - the event that caused the data change
See Also:
ChartDataModelListener.chartDataChanged(com.approximatrix.charting.event.ChartDataModelEvent)

setCenterLabelsBetweenTicks

void setCenterLabelsBetweenTicks(boolean value)
Forces the coordinate system to place the label centered between tick marks (for bar charts for example).

Parameters:
value - true to center, false otherwise

isCenterLabelsBetweenTicks

boolean isCenterLabelsBetweenTicks()
Returns true if labels are centered between ticks.

Returns:
true if centered between ticks, false if centered on ticks