|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.davisor.graphics.chart.ChartFactory.ChartMetrics
com.davisor.graphics.chart.AxisFactory.AxisMetrics
AxisMetrics is an AxisFactory internal info container that carries axis chart manufacturing parameters. An axis coordinate system is divided into several sections as shown by the following diagram:
major plot minor
:---------------->------------>----->
: : back-----> :
: : : core-> : :
: : : : : : :
XY = 2D coordinate area (core plane)
aw sw Z = 3D coordinate area (side planes)
EW_tw_+mw_?lw_#*_rw__@______@_*$_ew
| | || || |:: : : : :: : |eh tw = titleWidth
|..|..||..||..|::....:.:....:.::.:..| th = titleHeight
|..|..||..||..|::.../|.:....:.::.:..|$s
|..|..||..||..|::../.|.:....:.::.:..|*h mw = markerWidth
| | || || |:: / /|.:____:.::.:..|@ mh = markerHeight
| | || || |::| / | | | :: : |
| | || || |:y|/ | | XY | :: : | lw = labelWidth
| | || || |:y| Z |.|____|.::.:..| lh = labelHeight
| | || || |:y| |________:__:..|@
h| | || || |:y| / /::/: | sw = symbolWidth
e| | || || |:y| / Z / :/ : |rh sh = symbolHeight
i| | || || |:y|/________/__/: : |
g|..|..||..||..|::xxxxxxxxxxx..::.:..|*a @ = plot offset
h|..|..||..||..|::.............::.:..|#h * = axis offset
t| | || || |:: :: : | # = label offset
| | || || |:: axis :: : | + = title offset
|..|..||..||..|_____________________| $ = symbol offset
| | || || ::: :: : | ? = marker offset
| | || || ::: labels :: : |lh
|..|..||..||________________________| aw = axisWidth (sum of * and #)
|..|..||..|_________________________|? ah = axisHeight (sum of * and #)
| | || :: ::: :: : | sw = symbolWidth (sum of * and $)
| | || :: ::: markers :: : |mh sh = symbolHeight: sum of * and $
|..|..||____________________________|
|..|..|_____________________________|+ rw = rotWidth
| | :: :: ::: :: : | rh = rotHeight
| | :: :: ::: title :: : |th
|..|________________________________| EW = major edgeWidth
| : :: ::: ::: :: : |EH EH = major edgeHeight
y|___________________________________| ew = minor edgeWidth
x width eh = minor edgeHeight
Left/bottom edges are considered major edges as they may hold
labels and titles. Right/top edges are considered minor edges as
they may not hold labels and titles.
Width and height measure the total extends of the whole chart system. Other values measure the sizes of various components around central core area. Core area size is whatever is left over when all the other components are substracted from the total available area.
Title width measures the width of the outermost left column that actually contains some information, namely Y -axis title text. Title height measures the same for X -axis title text.
Beyond the title areas are major outer edges that contain space for overwide X- and Y -axis labels. An overwide label is a label so wide that when it starts from the origo, it crosses the orthgonal label and title areas, and extends still beyound them. Labels this wide are not typical however, so in most cases outer edges have zero width and heigh.
Title offset width measures the width between the Y -axis titles and labels. Title offset height measures the same for X -axis titles and labels.
Label width measures the width of the second outermost left column that contains information, namely, Y -axis labels. Label height measures the same for X -axis labels.
Axis width measures the width between plot area left edge and Y -axis label column. Axis height measures the same for X -axis. Axis width and height are sums of axis and label offsets.
Label offset width measures the width between the Y -axis line outer edge and Y -axis label column. Label offset height does the same for X -axis. The label offsets reserve space for symbols sticking out from principal plot area, and possible for some extra space, too. In particular, the gap between labels and axis line is visually so significant that the gap width is an user configurable axis attribute parameter.
Axis offset width measures the distance between Y -axis line center and the outer edge of the same line. In other words, this equals half of the Y -axis line width. Plese note also, that the inner half of axis line overlaps with plot area. Axis offset height measures the same for X -axis line. Typically, axis lines are quite thin, and axis offsets remain quite insignificant. With wider axis lines however, this is not so anymore, and therefore axis offsets must be taken into account when axis chart section sizes are measured.
Rotation width reserves space for horizontal isometric rendering. Rotation height does the same for vertical direction.
Plot offset width measures the gap between core drawing area and Y -axis line center. Plot offset height does the same for X -axis. The gap is used to reserve space for symbols like outer halves of edgemost bars in bar charts.
On the other side of plot area, symbol offsets reserve space for symbols that stick outside the top and right plot area edges. Symbol area serves much the same purpose as label offsets on plot area bottom and left edge, but with the difference that symbol offset area is right next to plot area, without an axis area between.
Beyound symbol offset area, outer minor edges measure the width of areas simimar to outer major edges. In particular, outer minor edges reserve space for labels that extend over orthogonal symbol areas and beyond. This is much more common a situation than with major outer edges, since symbol areas are typically much thinner than corresponding label and title areas.
All metric measurements use device coordinates.
DataValue.deinterpolate(com.davisor.data.DataValue, com.davisor.data.DataValue),
Type.zero()| Field Summary | |
protected float |
M_ax
Multiplier to orient X-axis. |
protected float[] |
M_axisOffset
Axis offset size (never negative). |
protected float |
M_ay
Multiplier to orient Y-axis. |
protected java.awt.Shape[] |
M_clip
Clipping shapes for the coordinate area clipping. |
protected float[] |
M_coreSize
Precomputed backplane size. |
protected float[] |
M_labelOffset
Label offset size (never negative). |
protected float[] |
M_labelSize
Label size. |
protected float[] |
M_majorEdge
Major edge size. |
protected float[] |
M_markerOffset
Marker offset size. |
protected float[] |
M_markerSize
Marker size. |
protected float[] |
M_minorEdge
Minor edge size. |
protected boolean[] |
M_opposite
Axis opposite status. |
protected float[] |
M_origo
Chart origo coordinates. |
protected float[] |
M_plotOffset
Plot offset size. |
protected boolean[] |
M_reverse
Axis reverse status. |
protected float[] |
M_rotSize
Isometric shear section size. |
protected float[] |
M_symbolOffset
Symbol offsets. |
protected float[] |
M_titleOffset
Title offset size (never negative). |
protected float[] |
M_titleSize
Title size. |
| Fields inherited from class com.davisor.graphics.chart.ChartFactory.ChartMetrics |
M_height, M_width |
| Constructor Summary | |
AxisFactory.AxisMetrics(ChartAxes axes,
float width,
float height,
float[] titleSize,
float[] labelSize,
float[] markerSize,
float[] axisOffset,
float[] labelOffset,
float[] markerOffset,
float[] symbolOffset,
float[] majorEdge,
float[] minorEdge,
float[] rotSize)
Creates a new internal axis info bundle. |
|
AxisFactory.AxisMetrics(float width,
float height)
Creates new chart metrics. |
|
| Method Summary | |
void |
clip(java.awt.Graphics g,
int clipIndex)
Controls which coordinate area clipping is enabled if any. |
void |
computeClip(boolean isometric)
Calculates the clipping area for the coordinate area. |
protected void |
computeCoreSize(int dim)
Computes coordinate back area size. |
float[] |
getAxisOffset()
Gets the gap between the axis stroke line center and edge. |
float[] |
getAxisSize()
Gets the gaps between the axis stroke line center and the top/right edge of axis labels area. |
float |
getAxisSize(int dim)
Gets the gap between the axis stroke line center and the top/right edge of axis labels area. |
float[] |
getBackSize()
Gets back area size. |
float |
getBottomMargin()
Gets the bottom margin area height. |
float[] |
getCoreSize()
Gets the core area size. |
float[] |
getLabelOffset()
Gets the gap between the axis stroke line center and the top/right edge of axis area. |
float[] |
getLabelSize()
Gets the label size. |
float |
getLeftMargin()
Gets the left margin area width. |
float[] |
getMajorEdge()
Gets the major edge size. |
float |
getMajorMargin(int dim)
Gets the left/bottom margin area size. |
float |
getMargins(int dim)
Gets the plotting area margins size. |
float[] |
getMarkerOffset()
Gets the gap between markers and labels. |
float[] |
getMarkerSize()
Gets the marker label size. |
float[] |
getMinorEdge()
Gets the minor edge size. |
float[] |
getMinorMargin()
Gets the right/top margin sizes. |
float |
getMinorMargin(int dim)
Gets the right/top margin size. |
float[] |
getOrigo()
Gets origo coordinates. |
float[] |
getPlotOffset()
Gets the plot offset. |
float[] |
getPlotSize()
Gets plotting area size in a new array. |
float |
getPlotSize(int dim)
Gets the plotting area area size. |
float |
getRightMargin()
Gets the right margin width. |
float[] |
getRotSize()
Gets the isometric shear section size. |
float |
getRotSize(int dim)
Gets the plot size compensated with isometric shear section size. |
float[] |
getSymbolOffset()
Gets the symbol offset. |
float[] |
getSymbolSize()
Gets the gap between the axis area and the left/bottom edge of minor edge. |
float |
getSymbolSize(int dim)
Gets the gap between the axis area and the left/bottom edge of minor edge. |
float[] |
getTitleOffset()
Gets the gap between the axis title and label areas. |
float[] |
getTitleSize()
Gets the title size. |
float |
getTopMargin()
Gets the top margin height. |
float |
getXOrient()
Gets the multiplier that is used to orientate the X-axis. |
float |
getYOrient()
Gets the multiplier that is used to orientate the Y-axis. |
protected void |
init(ChartAxes axes,
float[] titleSize,
float[] labelSize,
float[] markerSize,
float[] axisOffset,
float[] labelOffset,
float[] markerOffset,
float[] symbolOffset,
float[] majorEdge,
float[] minorEdge,
float[] rotSize)
Initializes metrics. |
boolean |
isOpposite(int dim)
Tests if given axis is in opposite position. |
void |
modifySize(int dim,
float change)
Changes chart size by modifying plot area size. |
void |
scale(float xFactor,
float yFactor)
Scales all metrics components. |
void |
scale(int dim,
float factor)
Applies linear scalar factor for given metrics dimension. |
void |
scaleToSize(java.lang.Number width,
java.lang.Number height)
Scales the metrics to make the chart meet given new size. |
void |
setAxisOffset(int dim,
float axisOffset,
boolean keepPlot)
Sets the gap between the axis stroke line center and edge. |
void |
setAxisSize(int dim,
float axisSize,
boolean keepPlot)
Sets the gap between the plot area outer edge and the labels area inner edge. |
void |
setCoreSize(float[] coreSize)
Sets the axis core area size. |
void |
setLabelOffset(int dim,
float labelOffset,
boolean keepPlot)
Sets the gap between the axis stroke line outer edge and the label area inner edge. |
void |
setLabelSize(int dim,
float labelSize,
boolean keepPlot)
Sets label size. |
void |
setMajorEdge(int dim,
float majorEdge,
boolean keepPlot)
Sets major edge size. |
void |
setMarkerOffset(int dim,
float markerOffset,
boolean keepPlot)
Sets the gap between the label area outer edge and the marker area inner edge. |
void |
setMarkerSize(int dim,
float markerSize,
boolean keepPlot)
Sets marker size. |
void |
setMinorEdge(int dim,
float minorEdge,
boolean keepPlot)
Sets minor edge size. |
void |
setMinorMargin(int dim,
float marginSize,
boolean keepPlot)
Sets the gap between plot area minor edge and chart outer edge. |
void |
setOrigo(float[] position)
Sets origo position. |
void |
setOrigo(int dim,
float position)
Sets origo position. |
void |
setPlotOffset(float[] plotOffset,
boolean keepPlot)
Sets the plot offset width/height. |
void |
setPlotOffset(int dim,
float plotOffset)
Sets the plot offset width/height. |
void |
setPlotOffset(int dim,
float plotOffset,
boolean keepPlot)
Sets the plot offset width/height. |
void |
setRotSize(int dim,
float rotSize)
Sets the isometric shear section's height. |
void |
setSize(int dim,
float size)
Sets the chart image's total height in device coordinates. |
void |
setSize(java.awt.geom.Rectangle2D backArea)
Sets the size of the chart being manufactured. |
void |
setSymbolOffset(int dim,
float symbolOffset,
boolean keepPlot)
Sets the gap between the axis offset area and minor edge. |
void |
setSymbolSize(int dim,
float symbolSize,
boolean keepPlot)
Sets the symbol size width/height. |
void |
setTitleOffset(int dim,
float titleOffset,
boolean keepPlot)
Sets the gap between the label area outer edge and the title area inner edge. |
void |
setTitleSize(int dim,
float titleSize,
boolean keepPlot)
Sets title size. |
void |
setXOrient(float ax)
Sets the multiplier that is used to orientate the X -axis. |
void |
setYOrient(float ay)
Sets the multiplier that is used to orientate the Y -axis. |
java.lang.String |
toString()
Gets axis metrix XML representation. |
float |
x(float x)
Maps X device coordinate on X -axis according to current axis rendering preferences. |
float |
y(float y)
Maps Y device coordinate on Y -axis according to current axis rendering preferences. |
| Methods inherited from class com.davisor.graphics.chart.ChartFactory.ChartMetrics |
add, getHeight, getSize, getWidth, setHeight, setWidth |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected float[] M_axisOffset
protected float[] M_majorEdge
protected float[] M_minorEdge
protected float[] M_labelOffset
protected float[] M_labelSize
protected float[] M_markerOffset
protected float[] M_markerSize
protected float[] M_origo
protected float[] M_plotOffset
protected float[] M_rotSize
protected float[] M_symbolOffset
protected float[] M_titleOffset
protected float[] M_titleSize
protected float M_ax
protected float M_ay
protected java.awt.Shape[] M_clip
protected boolean[] M_opposite
protected boolean[] M_reverse
protected transient float[] M_coreSize
| Constructor Detail |
public AxisFactory.AxisMetrics(float width,
float height)
width - chart width, in millimetersheight - chart height, in millimeters
public AxisFactory.AxisMetrics(ChartAxes axes,
float width,
float height,
float[] titleSize,
float[] labelSize,
float[] markerSize,
float[] axisOffset,
float[] labelOffset,
float[] markerOffset,
float[] symbolOffset,
float[] majorEdge,
float[] minorEdge,
float[] rotSize)
axes - chart axeswidth - chart width, in millimetersheight - chart height, in millimeterstitleSize - title area sizelabelSize - label area sizemarkerSize - marker area sizeaxisOffset - axis offsetslabelOffset - label offsetsmarkerOffset - marker offsetssymbolOffset - symbol offsetsmajorEdge - major edge sizeminorEdge - minor margin (see above)rotSize - isometric area sizeinit(com.davisor.graphics.chart.ChartAxes, float[], float[], float[], float[], float[], float[], float[], float[], float[], float[])| Method Detail |
public void scale(float xFactor,
float yFactor)
This implementation scales both X and Y dimensions separately with
two calls to scale(int,float).
scale in class ChartFactory.ChartMetricsxFactor - horizontal scalar factoryFactor - vertical scalar factorscale(int,float)
public void scaleToSize(java.lang.Number width,
java.lang.Number height)
This implementation recomputes axis chart size by calling
setSize(int,float) for not null given
components. This will scale axis chart components in optimal,
non-linear way. In particular, the chart core area size will be
affected more than other components, to preserve any earlier
delicate text component size computations.
scaleToSize in class ChartFactory.ChartMetricswidth - new chart width (may be null = keep the old width)height - new chart height (may be null = keep the old height)ChartFactory.ChartMetrics.getSize(int)public java.lang.String toString()
protected void computeCoreSize(int dim)
getPlotSize(int),
getRotSize(int)
protected void init(ChartAxes axes,
float[] titleSize,
float[] labelSize,
float[] markerSize,
float[] axisOffset,
float[] labelOffset,
float[] markerOffset,
float[] symbolOffset,
float[] majorEdge,
float[] minorEdge,
float[] rotSize)
axes - chart axestitleSize - title area sizelabelSize - label area sizemarkerSize - marker area sizeaxisOffset - axis offsetslabelOffset - label offsetsmarkerOffset - marker offsetssymbolOffset - symbol offsetsmajorEdge - major edge sizeminorEdge - minor margin (see above)rotSize - isometric area size
public void clip(java.awt.Graphics g,
int clipIndex)
clipIndex - determines which clipping area to enablecomputeClip(boolean)public void computeClip(boolean isometric)
isometric - flag for isometric mode calculationsclip(Graphics,int)public float[] getAxisSize()
setAxisSize(int, float, boolean)public float getAxisSize(int dim)
dim - dimension index (X or Y)setAxisSize(int, float, boolean)public float[] getAxisOffset()
setAxisOffset(int, float, boolean)public float[] getBackSize()
getCoreSize(),
getPlotOffset()public float getBottomMargin()
getMajorMargin(int)public float[] getCoreSize()
getBackSize(),
ChartFactory.ChartMetrics.getSize(int)public float[] getLabelSize()
public float[] getLabelOffset()
public float getLeftMargin()
getMajorMargin(int)public float[] getMajorEdge()
public float getMajorMargin(int dim)
getAxisSize()public float getMargins(int dim)
getMajorMargin(int),
getMinorMargin()public float[] getMarkerSize()
public float[] getMarkerOffset()
public float[] getMinorEdge()
public float[] getMinorMargin()
public float getMinorMargin(int dim)
dim - dimension index (X or Y)getSymbolSize()public float[] getOrigo()
public float[] getPlotOffset()
public float[] getPlotSize()
getPlotSize(int)public float getPlotSize(int dim)
getMajorMargin(int),
getMinorMargin()public float getRightMargin()
getMinorMargin()public float[] getRotSize()
getRotSize(int)public float getRotSize(int dim)
dim - dimension index (X or Y)getRotSize(),
getPlotSize(int)public float[] getSymbolOffset()
public float[] getSymbolSize()
setSymbolSize(int, float, boolean)public float getSymbolSize(int dim)
dim - dimension index (X or Y)setSymbolSize(int, float, boolean)public float[] getTitleOffset()
public float[] getTitleSize()
public float getTopMargin()
getMinorMargin()public float getXOrient()
public float getYOrient()
public boolean isOpposite(int dim)
public void modifySize(int dim,
float change)
dim - dimension index (X or Y)change - plot area size change
public void scale(int dim,
float factor)
scale in class ChartFactory.ChartMetricsdim - dimension index (X or Y)factor - scalar factorscale(float,float)
public void setAxisOffset(int dim,
float axisOffset,
boolean keepPlot)
Changing axis offset has a symmetric effect on both sides of the plot area because axis offset width controls on axis line width on left and right side of the plot area, and axis offset height does the same on top and bottom side.
dim - dimension index (X or Y)axisOffset - new axis size valuekeepPlot - maintain plot area size by changing chart sizegetAxisOffset()
public void setAxisSize(int dim,
float axisSize,
boolean keepPlot)
axisSize - axisOffset. Note, that this may result
negative label offset value.
dim - dimension index (X or Y)axisSize - new axis size valuekeepPlot - maintain plot area size by changing chart sizesetLabelOffset(int, float, boolean)public void setCoreSize(float[] coreSize)
public void setMajorEdge(int dim,
float majorEdge,
boolean keepPlot)
dim - dimension index (X or Y)majorEdge - new edge size valuekeepPlot - maintain plot area size by changing chart size
public void setMinorEdge(int dim,
float minorEdge,
boolean keepPlot)
dim - dimension index (X or Y)minorEdge - new edge size valuekeepPlot - maintain plot area size by changing chart size
public void setLabelOffset(int dim,
float labelOffset,
boolean keepPlot)
dim - dimension index (X or Y)labelOffset - new label offset valuekeepPlot - maintain plot area size by changing chart size
public void setLabelSize(int dim,
float labelSize,
boolean keepPlot)
dim - dimension index (X or Y)labelSize - new label size valuekeepPlot - maintain plot area size by changing chart size
public void setMinorMargin(int dim,
float marginSize,
boolean keepPlot)
margin -
symbolSize. Note, that this may result negative edge
size value.
dim - dimension index (X or Y)marginSize - new margin size valuekeepPlot - maintain plot area size by changing chart sizegetSymbolSize()
public void setMarkerOffset(int dim,
float markerOffset,
boolean keepPlot)
dim - dimension index (X or Y)markerOffset - new marker offset valuekeepPlot - maintain plot area size by changing chart size
public void setMarkerSize(int dim,
float markerSize,
boolean keepPlot)
dim - dimension index (X or Y)markerSize - new marker size valuekeepPlot - maintain plot area size by changing chart sizepublic void setOrigo(float[] position)
public void setOrigo(int dim,
float position)
public void setPlotOffset(int dim,
float plotOffset)
Changing plot offset has a symmetric effect on both sides of the plot area because axis offset width controls on plot offset width on left and right side of the plot area, and plot offset height does the same on top and bottom side.
dim - dimension index (X or Y)plotOffset - new plot offset value
public void setPlotOffset(float[] plotOffset,
boolean keepPlot)
plotOffset - new plot offset valueskeepPlot - maintain plot area size by changing chart size
public void setPlotOffset(int dim,
float plotOffset,
boolean keepPlot)
Plot offset and edge sizes should never be negative. In
particular, if plot offset grows more than the current edge
size can shrink, edge size will become zero, and the extra size
will either be taken away from current plot area size, or added
to current total chart size, as controlled by the
keepPlot argument.
dim - dimension index (X or Y)plotOffset - new plot offset valuekeepPlot - maintain plot area size by changing chart size
public void setRotSize(int dim,
float rotSize)
public void setSize(java.awt.geom.Rectangle2D backArea)
Changing chart size changes also chart plot area size.
setSize(int,float)
public void setSize(int dim,
float size)
If chart core size would fall below 10% of the whole chart size, size reduction is applied on all chart areas.
setSize in class ChartFactory.ChartMetricsdim - dimension index (X or Y)size - new chart size valuecomputeCoreSize(int)
public void setSymbolOffset(int dim,
float symbolOffset,
boolean keepPlot)
dim - dimension index (X or Y)symbolOffset - new symbol size valuekeepPlot - maintain plot area size by changing chart sizegetSymbolOffset()
public void setSymbolSize(int dim,
float symbolSize,
boolean keepPlot)
Symbol and edge sizes should never be negative. In particular,
if symbol size grows more than the current edge size can
shrink, edge size will become zero, and the extra size will
either be taken away from current plot area size, or added to
current total chart size, as controlled by the
keepPlot argument.
dim - dimension index (X or Y)symbolSize - new symbol size valuekeepPlot - maintain plot area size by changing chart size
public void setTitleOffset(int dim,
float titleOffset,
boolean keepPlot)
dim - dimension index (X or Y)titleOffset - new title offset valuekeepPlot - maintain plot area size by changing chart size
public void setTitleSize(int dim,
float titleSize,
boolean keepPlot)
dim - dimension index (X or Y)titleSize - new title size valuekeepPlot - maintain plot area size by changing chart sizepublic void setXOrient(float ax)
public void setYOrient(float ay)
public float x(float x)
Currently only axis reversal is supported. Later versions will support logarithmic and discontinuous scales.
x - X -axis device coordinate
y(float)public float y(float y)
Currently only axis reversal is supported. Later versions will support logarithmic and discontinuous scales.
y - Y -axis device coordinate
x(float)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||