|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.davisor.graphics.chart.ChartFactory
com.davisor.graphics.chart.LegendFactory
com.davisor.graphics.chart.ScaleLegendFactory
ScaleLegendFactory provides common functionality to legend factories that show scales in a legend. The common functionality provides the calculation of the size of the legend, scaling of the legend and drawing of legend entries.
Each subclass is expected to create the context, which is provided in this class, for the chart and provide the method for creating the chart.
| Nested Class Summary | |
class |
ScaleLegendFactory.ScaleLegendContext
Context information for legend size calculation and drawing. |
class |
ScaleLegendFactory.ScaleLegendEntry
Contains shape, label, and size information. |
class |
ScaleLegendFactory.ScaleLegendMetrics
Legend metrics contain the legend sizing information. |
| Nested classes inherited from class com.davisor.graphics.chart.ChartFactory |
ChartFactory.ChartContext, ChartFactory.ChartMetrics |
| Field Summary | |
static int |
DEFAULT_BORDER_PADDING
Default border padding (3). |
static int |
DEFAULT_HORIZONTAL_LABEL_GAP
Default horizontal gap between shape and label (20). |
| Fields inherited from class com.davisor.graphics.chart.ChartFactory |
ALL, BRIGHT, CHANNEL, COS, DARK, DOTSEQUENCE, DOTSTROKE, DOTSTROKEWIDTH, DUMPFACTORYNAME, ENCODERINFO, FONT, FRC, HAS_3D, I, LABEL, LABELFIELDNAMES, LABELFIELDS, MIME_DEFAULT, NONE, NORMAL, NULLSTROKE, PERCENT, PI2, SHAPE, SIN, STROKE, STROKEWIDTH, TIC, VALUE, X, Y, Z |
| Fields inherited from interface com.davisor.core.MIMETypes |
FILETYPE_BMP, FILETYPE_CSS, FILETYPE_DOC, FILETYPE_ECMA, FILETYPE_GIF, FILETYPE_HTML, FILETYPE_HTML_CSS, FILETYPE_INDEX, FILETYPE_INDEX_DOC, FILETYPE_INDEX_HTML, FILETYPE_INDEX_HTML_CSS, FILETYPE_INDEX_PDF, FILETYPE_INDEX_PPT, FILETYPE_INDEX_SVG, FILETYPE_INDEX_XHTML, FILETYPE_INDEX_XLS, FILETYPE_INDEX_XMSE, FILETYPE_INDEX_XMSP, FILETYPE_INDEX_XMSW, FILETYPE_INDEX_XSLFO, FILETYPE_JPEG, FILETYPE_PDF, FILETYPE_PNG, FILETYPE_PNG_WBMP, FILETYPE_PPM, FILETYPE_PPT, FILETYPE_SVG, FILETYPE_TEXT, FILETYPE_WBMP, FILETYPE_XHTML, FILETYPE_XLS, FILETYPE_XML, FILETYPE_XMSE, FILETYPE_XMSP, FILETYPE_XMSW, FILETYPE_XSLFO, FILETYPE_XSLFO_CSS, MIME_BMP, MIME_CSS, MIME_DOC, MIME_ECMA, MIME_GIF, MIME_HTML, MIME_HTML_CSS, MIME_INDEX, MIME_INDEX_DOC, MIME_INDEX_HTML, MIME_INDEX_HTML_CSS, MIME_INDEX_PDF, MIME_INDEX_PPT, MIME_INDEX_SVG, MIME_INDEX_XHTML, MIME_INDEX_XLS, MIME_INDEX_XMSE, MIME_INDEX_XMSP, MIME_INDEX_XMSW, MIME_INDEX_XSLFO, MIME_JPEG, MIME_OTHER, MIME_PDF, MIME_PNG, MIME_PNG_WBMP, MIME_PPM, MIME_PPT, MIME_SVG, MIME_TEXT, MIME_WBMP, MIME_XHTML, MIME_XLS, MIME_XML, MIME_XMSE, MIME_XMSP, MIME_XMSW, MIME_XSLFO, MIME_XSLFO_CSS |
| Constructor Summary | |
ScaleLegendFactory()
Default constructor. |
|
ScaleLegendFactory(ChartFactory factory)
Copy contructor. |
|
| Method Summary | |
ChartFactory.ChartMetrics |
createMetrics(ChartFactory.ChartContext chartContext,
ChartAttributes attr)
Defines metrics for a scale legend factory. |
protected void |
drawHorizontalEntry(java.awt.Graphics2D g,
int horizontalLabelGap,
int horizontalShapeGap,
boolean ignoreShape,
java.lang.String label,
boolean labelAtLeft,
java.awt.Paint labelColor,
java.awt.Font labelFont,
float labelHeight,
java.awt.Paint labelPaint,
float labelWidth,
float maximumEntryHeight,
float maximumShapeHeight,
float maximumShapeWidth,
java.awt.Paint pointColor,
java.awt.Paint pointPaint,
java.awt.Shape pointShape,
java.awt.Stroke pointStroke,
float shapeHeight,
float shapeWidth,
int verticalShapeGap,
float x,
float y)
Draws a horizontal legend entry. |
protected void |
drawVerticalEntry(java.awt.Graphics2D g,
int horizontalLabelGap,
int horizontalShapeGap,
boolean ignoreShape,
java.lang.String label,
java.awt.Paint labelColor,
java.awt.Font labelFont,
float labelHeight,
java.awt.Paint labelPaint,
float labelWidth,
float maximumEntryHeight,
float maximumShapeHeight,
float maximumShapeWidth,
java.awt.Paint pointColor,
java.awt.Paint pointPaint,
java.awt.Shape pointShape,
java.awt.Stroke pointStroke,
float shapeHeight,
float shapeWidth,
int verticalShapeGap,
float x,
float y)
Draw a vertical legend entry. |
| Methods inherited from class com.davisor.graphics.chart.LegendFactory |
getLabelBackgroundPaint, mayHaveLegend |
| Methods inherited from class com.davisor.graphics.chart.ChartFactory |
annotate, combineProperties, createChannelType, createChannelType, createChart, createChart, createChart, createChart, createChart, createChart, createContext, createFormat, createPaintChannelType, createPaintChannelType, createShapeChannelType, createShapeChannelType, createSummary, drawLabel, getContentType, getDefaultPaint, getFactory, getFactory, getGroup, getIsometricCoefficients, getLegendShape, getName, has3D, hasSVG, isClassAvailable, isMultiSeriesMode, main, registerFactory, resolveDataLimits, resolveDataLimits, rotateSize, shade, unregisterFactory |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.davisor.core.Dupable |
dup |
| Field Detail |
public static final int DEFAULT_HORIZONTAL_LABEL_GAP
public static final int DEFAULT_BORDER_PADDING
| Constructor Detail |
public ScaleLegendFactory()
public ScaleLegendFactory(ChartFactory factory)
| Method Detail |
public ChartFactory.ChartMetrics createMetrics(ChartFactory.ChartContext chartContext,
ChartAttributes attr)
throws ChartException
createMetrics in class ChartFactorychartContext - chart contextattr - chart attributes
ChartException - if chart generation fails
protected void drawHorizontalEntry(java.awt.Graphics2D g,
int horizontalLabelGap,
int horizontalShapeGap,
boolean ignoreShape,
java.lang.String label,
boolean labelAtLeft,
java.awt.Paint labelColor,
java.awt.Font labelFont,
float labelHeight,
java.awt.Paint labelPaint,
float labelWidth,
float maximumEntryHeight,
float maximumShapeHeight,
float maximumShapeWidth,
java.awt.Paint pointColor,
java.awt.Paint pointPaint,
java.awt.Shape pointShape,
java.awt.Stroke pointStroke,
float shapeHeight,
float shapeWidth,
int verticalShapeGap,
float x,
float y)
--------------- - label shape - ---------------
--------------- - shape label - ---------------
The center (0,0) of the shape is positioned with:
(x + labelWidth +
(shapeWidth + maximumShapeWidth *
(horizontalShapeGap + horizontalLabelGap) / 100) / 2,
y + maximumEntryHeight / 2)
(x + (shapeWidth + maximumShapeWidth *
(horizontalShapeGap + horizontalLabelGap) / 100) / 2,
y + maximumEntryHeight / 2)
The top left corner of the label is positioned with:
(x, y + (maximumEntryHeight - labelHeight) / 2)
(x + shapeWidth + maximumShapeWidth * (horizontalShapeGap +
horizontalLabelGap) / 100,
y + (maximumEntryHeight - labelHeight) / 2)
If the shape is ignored, the x-coordinate of the label is simply x.
g - graphics containerhorizontalLabelGap - gap between shape and labelhorizontalShapeGap - gap divided to the left and right side of shapeignoreShape - should shape be ignored in label positioninglabel - text of the labellabelAtLeft - should label be before shapelabelColor - color of the labellabelFont - font of the labellabelHeight - height of the labellabelPaint - paint of the labellabelWidth - width of the labelmaximumEntryHeight - maximum height of the entrymaximumShapeHeight - maximum shape heightmaximumShapeWidth - maximum shape widthpointColor - color of the shape (may be null)pointPaint - paint of the shape (may be null)pointShape - shape of the entry (may be null)pointStroke - stroke of the shape (may be null)shapeHeight - height of the shape (ignored)shapeWidth - width of the shapeverticalShapeGap - gap to the top and bottom side of shape (ignored)x - x-coordinatey - y-coordinate
protected void drawVerticalEntry(java.awt.Graphics2D g,
int horizontalLabelGap,
int horizontalShapeGap,
boolean ignoreShape,
java.lang.String label,
java.awt.Paint labelColor,
java.awt.Font labelFont,
float labelHeight,
java.awt.Paint labelPaint,
float labelWidth,
float maximumEntryHeight,
float maximumShapeHeight,
float maximumShapeWidth,
java.awt.Paint pointColor,
java.awt.Paint pointPaint,
java.awt.Shape pointShape,
java.awt.Stroke pointStroke,
float shapeHeight,
float shapeWidth,
int verticalShapeGap,
float x,
float y)
--------------- - shape label - ---------------
The center (0,0) of the shape is positioned with:
(x + maximumShapeWidth *
(1 + (horizontalShapeGap + horizontalLabelGap) / 100) / 2,
y + max(labelHeight,
shapeHeight + maximumShapeHeight * verticalShapeGap / 100) / 2)
The top left corner of the label is positioned with:
(x + maximumShapeWidth * (1 + (horizontalShapeGap +
horizontalLabelGap) / 100),
y + (max(labelHeight,
shapeHeight + maximumShapeHeight * verticalShapeGap / 100) -
labelHeight) / 2
g - graphics containerhorizontalLabelGap - gap between shape and labelhorizontalShapeGap - gap divided to the left and right side of shapeignoreShape - should shape be ignored in label positioning (ignored)label - text of the labellabelColor - color of the labellabelFont - font of the labellabelHeight - height of the labellabelPaint - paint of the labellabelWidth - width of the labelmaximumEntryHeight - maximum height of an entry (ignored)maximumShapeHeight - maximum height of a shapemaximumShapeWidth - maximum width of a shapepointColor - color of the shape (may be null)pointPaint - paint of the shape (may be null)pointShape - shape (may be null)pointStroke - stroke of the shape (may be null)shapeHeight - height of the shapeshapeWidth - width of the shape (ignored)verticalShapeGap - gap divided to the top and bottom side of shapex - x-coordinatey - y-coordinate
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||