|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.approximatrix.charting.render.AbstractRenderer
com.approximatrix.charting.coordsystem.AbstractCoordSystem
com.approximatrix.charting.coordsystem.ClassicCoordSystem
public class ClassicCoordSystem
This class defines a coordinate system. The ClassicCoordSystem class computes
an AffineTransform for each y-axis, which translates the user space
coordinates (ie. the data value coordinates) into pixel space coordinates.
These AffineTransform classes make the PixelToPointTranslator obsolete,
since it provides more flexibility. getDefaultTransform always
computes the default transformation, whereas you can set another
transformation via setTransform. This will be used to implement
zooming and panning in the Swing classes.
All classes incl. this one, which render data will use the transformations to translate the coordinates. The transformations are not set up on instantiation of a ClassicCoordSystem, instead they're computed when setBounds is called, because they need this information of course. Afterwards you can set your own transformation or even better you can manipulate the existing ones by pre- or postconcatenating another AffineTransform.
| Field Summary | |
|---|---|
int |
ARROWLENGTH
The arrow length constant. |
protected ClassicCoordSystemUtilities |
c
The utilities class, which contains all the rendering methods etc. |
protected ChartDataModelConstraints |
constraints
The ChartDataModel constraints of the first y-axis and the x-axis. |
protected ChartDataModelConstraints |
constraints2
The ChartDataModel constraints of the second y-axis and the x-axis. |
protected java.awt.font.FontRenderContext |
frc
FontRenderContext used througout the ClassicCoordSystem |
int |
MINIMALMARGIN
The minimal margin constant. |
protected ChartDataModel |
model
The DataModel class. |
protected boolean |
shouldDrawArrows
if true, the arrows will be drawn at the end of the axi |
protected boolean |
shouldPaintAltTick
if true, the increment will be painted at each tick mark |
| Fields inherited from class com.approximatrix.charting.coordsystem.AbstractCoordSystem |
|---|
bottommargin, bounds, centerObjectLabelsBetweenTicks, dfX, dfY, leftmargin, listener, rightmargin, shouldPaintAxes, shouldPaintGrid, shouldPaintLabels, shouldPaintOnlyTick, tickFont, topmargin, unitFont, xaxis, xaxis_unit, y1transform, y2transform, yaxis, yaxis_unit, yaxis2 |
| Fields inherited from interface com.approximatrix.charting.coordsystem.CoordSystem |
|---|
FIRST_YAXIS, SECOND_YAXIS |
| Constructor Summary | |
|---|---|
ClassicCoordSystem(ChartDataModel cdm)
Creates a new ClassicCoordSystem using the given model constraints. |
|
ClassicCoordSystem(ChartDataModel c,
java.text.DecimalFormat yAxisFormat,
boolean drawArrows,
boolean paintAltYTick,
boolean paintOnlyYTick)
Create a new ClassicCoordSystem with alternate painting parameters. |
|
ClassicCoordSystem(ChartDataModel c,
java.lang.String xunit,
java.lang.String yunit)
Creates a new ClassicCoordSystem using the given model constraints. |
|
| Method Summary | |
|---|---|
void |
chartDataChanged(ChartDataModelEvent evt)
Listener to force the recomputation of all transforms on data changes |
protected int |
computeBottomMargin()
Computes the bottom margin. |
protected int |
computeLeftMargin()
Computes the left margin. |
protected int |
computeRightMargin()
Computes the right margin. |
protected int |
computeTopMargin()
Computes the top margin. |
ChartDataModelConstraints |
getChartDataModelConstraints(int axis)
Returns the used ChartDataModelConstraints. |
java.awt.font.FontRenderContext |
getFontRenderContext()
Returns the FontRenderContext used througout the ClassicCoordSystem |
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 |
java.text.DecimalFormat |
getXDecimalFormat()
Returns the DecimalFormat used on the Xaxis |
java.text.DecimalFormat |
getYDecimalFormat()
Returns the DecimalFormat used on the Yaxis |
boolean |
isDrawArrows()
if true, the arrows will be drawn at the end of the axis |
boolean |
isPaintAltTick()
if true, the increment will be painted at each tick mark |
void |
paintDefault(java.awt.Graphics2D g)
This method is called by the paint method to do the actual painting. |
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 |
setCenterLabelsBetweenTicks(boolean value)
Forces the coordinate system to place the label centered between tick marks (for bar charts for example). |
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. |
| Methods inherited from class com.approximatrix.charting.render.AbstractRenderer |
|---|
getDirectRender, isDifferentBounds, setDirectRender |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.awt.font.FontRenderContext frc
protected boolean shouldDrawArrows
protected boolean shouldPaintAltTick
public final int MINIMALMARGIN
public final int ARROWLENGTH
protected ChartDataModelConstraints constraints
protected ChartDataModelConstraints constraints2
protected ChartDataModel model
protected ClassicCoordSystemUtilities c
| Constructor Detail |
|---|
public ClassicCoordSystem(ChartDataModel cdm)
c - the ChartDataModel needed to compute the DataConstraints.
public ClassicCoordSystem(ChartDataModel c,
java.lang.String xunit,
java.lang.String yunit)
c - the ChartDataModel needed to compute the DataConstraints.xtext - the x-axis unitytext - the y-axis unit
public ClassicCoordSystem(ChartDataModel c,
java.text.DecimalFormat yAxisFormat,
boolean drawArrows,
boolean paintAltYTick,
boolean paintOnlyYTick)
c - the ChartDataModel needed to compute the DataConstraints.drawArrows - if true the arrows will be drawn at the end of the axispaintAltYTick - if true the caption will paint on alternate ticks of the
yaxis instead of on every one.paintOnlyYTick - if true the horizontal lightgray line will not
appear behind the chart at each yaxis tick mark.| Method Detail |
|---|
public boolean isPaintAltTick()
public void paintDefault(java.awt.Graphics2D g)
AbstractRenderer
paintDefault in interface CoordSystempaintDefault in class AbstractCoordSystemg - the Graphics2D object to paint in.public java.awt.font.FontRenderContext getFontRenderContext()
public java.text.DecimalFormat getYDecimalFormat()
CoordSystem
getYDecimalFormat in interface CoordSystemgetYDecimalFormat in class AbstractCoordSystempublic java.text.DecimalFormat getXDecimalFormat()
CoordSystem
getXDecimalFormat in interface CoordSystemgetXDecimalFormat in class AbstractCoordSystempublic boolean isDrawArrows()
public ChartDataModelConstraints getChartDataModelConstraints(int axis)
CoordSystem
getChartDataModelConstraints in interface CoordSystempublic void setMaximumXTicks(int value)
CoordSystem
setMaximumXTicks in interface CoordSystemvalue - the maximum number of X ticks, or -1 to reset to defaultpublic void setMaximumYTicks(int value)
CoordSystem
setMaximumYTicks in interface CoordSystemvalue - the maximum number of Y ticks, or -1 to reset to defaultpublic int getMaximumXTicks()
CoordSystem
getMaximumXTicks in interface CoordSystempublic int getMaximumYTicks()
CoordSystem
getMaximumYTicks in interface CoordSystempublic void resetMaximumXTicks()
CoordSystem
resetMaximumXTicks in interface CoordSystempublic void resetMaximumYTicks()
CoordSystem
resetMaximumYTicks in interface CoordSystempublic void chartDataChanged(ChartDataModelEvent evt)
CoordSystem
chartDataChanged in interface CoordSystemchartDataChanged in interface ChartDataModelListenerevt - the event that caused the data changeChartDataModelListener.chartDataChanged(com.approximatrix.charting.event.ChartDataModelEvent)protected int computeBottomMargin()
AbstractCoordSystem
computeBottomMargin in class AbstractCoordSystemprotected int computeLeftMargin()
AbstractCoordSystem
computeLeftMargin in class AbstractCoordSystemprotected int computeRightMargin()
AbstractCoordSystem
computeRightMargin in class AbstractCoordSystemprotected int computeTopMargin()
AbstractCoordSystem
computeTopMargin in class AbstractCoordSystempublic void setCenterLabelsBetweenTicks(boolean value)
CoordSystem
setCenterLabelsBetweenTicks in interface CoordSystemsetCenterLabelsBetweenTicks in class AbstractCoordSystemvalue - true to center, false otherwise
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||