|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.objectplanet.chart.Renderer com.objectplanet.chart.ChartRenderer
public abstract class ChartRenderer
This class is the abstract superclass of all chart renderers.
Field Summary | |
---|---|
static int |
BELOW
Labels display below the chart grid. |
static int |
BELOW_AND_FLOATING
Labels display both below the grid and floating over a sample. |
protected java.awt.Point |
depth3dPoint
|
protected boolean |
display3dOn
|
static int |
FLOATING
Floating labels display when mouse is over a sample. |
protected GridRenderer |
gridRenderer
Used to paint the grid. |
static int |
HORIZONTAL
Horizontal bar alignment. |
static int |
INSIDE
Labels display inside each sample. |
protected long |
lastCalculationTime
|
protected Legend |
legend
This contains the legend data. |
protected LegendRenderer |
legendRenderer
Used to paint the legend. |
static int |
OUTSIDE
Labels display outside pie edge next to each sample. |
protected java.util.Vector |
overlayRenderers
This contains any overlayed chart renderers. |
protected ChartRenderer |
parentRenderer
The parent of the overlay chart. |
static int |
POINTING
Lines point to the corresponding slices. |
static int |
VERTICAL
Vertical bar alignment. |
Fields inherited from class com.objectplanet.chart.Renderer |
---|
chart, DEFAULT_CURSOR, DOUBLE_CLICK_TIME, GRID_CURSOR_HORZ, GRID_CURSOR_VERT, HAND_CURSOR, RESIZE_CURSOR, RESIZE_HOR_CURSOR |
Constructor Summary | |
---|---|
ChartRenderer()
Default constructor. |
|
ChartRenderer(GenericChart chart)
Creates a chart renderer for the given chart. |
Method Summary | |
---|---|
int |
addOverlayRenderer(ChartRenderer renderer)
Adds a new overlay renderer. |
protected abstract void |
calculateChartData(java.awt.Rectangle gridBounds,
java.awt.Rectangle dataBounds)
Calculates the data used for the chart. |
protected abstract void |
calculateGraphBounds(java.awt.Rectangle bounds)
This method returns the bounding box for the chart grid and has to be implemented by the subclass. |
protected void |
calculateOverlayBounds(ChartRenderer overlay,
int index,
java.awt.Rectangle gridBounds,
java.awt.Rectangle dataBounds)
Calculates grid bounds and data bounds for the given overlay. |
protected abstract void |
checkDataIntegrity()
This method is called each time the sample count or series count changes, and ensures that all the data has the right size. |
protected ChartSample |
checkSelection(java.awt.Point point)
This method is called when the user releases the mouse and checks if the given point is inside a sample. |
protected java.awt.Rectangle |
getLineChartBounds(java.awt.Rectangle dataBounds)
Calculates new bounds to be used for line charts. |
ChartRenderer |
getOverlayRenderer(int index)
Gets the specified overlay chart. |
protected abstract java.awt.Point |
getSampleCenter(int sample,
int serie)
Calculates the center point of the sample. |
protected boolean |
isAnyBelowLabelsOn()
Returns true if any labels below the grid should be painted. |
protected boolean |
isAnyFloatingLabelsOn(int serie)
Returns true if any floating labels should be painted for the specified serie. |
protected abstract void |
paintFloatingLabel(java.awt.Graphics g,
java.lang.String label,
java.awt.Rectangle gridBounds,
int sample,
int series,
java.awt.Font font,
java.awt.FontMetrics fm)
Paints a floating label. |
protected boolean |
paintFloatingLabels(java.awt.Graphics g,
java.awt.Rectangle gridBounds)
Paints floating labels. |
protected void |
paintGrid(java.awt.Graphics g,
Grid grid,
java.awt.Rectangle gridBounds)
This method is called when the chart grid should be rendered. |
protected void |
paintSampleHighlight(java.awt.Graphics g,
int serie,
int sample,
int x,
int y,
java.awt.Color color)
Paints the sample highlight for a point. |
void |
removeExternalGraphics()
Removes external graphics context if there is one. |
protected abstract void |
render(java.awt.Graphics g)
This method is called by paint(), and has to be implemented by the subclass to render the chart. |
protected void |
render(java.awt.Graphics g,
boolean offscreenOn)
Renders the chart according to the set attributes, the current features that are turned on and GUI state values. |
protected abstract void |
renderData(java.awt.Graphics g,
java.awt.Rectangle gridBounds,
java.awt.Rectangle dataBounds)
This method renders the data (bars, lines, pies). |
void |
reset()
Resets the chart data and features. |
void |
setExternalGraphics(java.awt.Graphics g,
java.awt.Image image)
Sets an external graphics context to paint with. |
void |
setOverlayRenderer(int index,
ChartRenderer renderer)
Sets the specified overlay renderer. |
Methods inherited from class com.objectplanet.chart.Renderer |
---|
clearBackground, fifo_add, fifo_clear, fifo_remove, getAngledLabelCache, getAngledLabelSize, getBrighter, getDarker, getfifo_count, getfifo_queue, getFont, getFontMetrics, getImageSize, getLabel, getLabelAngle, getLabelSize, getSampleCount, getSeriesCount, hashCode, paintBox, paintLabel, setLabelAngleCacheSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BELOW
public static final int BELOW_AND_FLOATING
protected java.awt.Point depth3dPoint
protected boolean display3dOn
public static final int FLOATING
protected GridRenderer gridRenderer
public static final int HORIZONTAL
public static final int INSIDE
protected long lastCalculationTime
protected Legend legend
protected LegendRenderer legendRenderer
public static final int OUTSIDE
protected java.util.Vector overlayRenderers
protected ChartRenderer parentRenderer
public static final int POINTING
public static final int VERTICAL
Constructor Detail |
---|
public ChartRenderer()
public ChartRenderer(GenericChart chart)
chart
- The chart object.Method Detail |
---|
public int addOverlayRenderer(ChartRenderer renderer)
renderer
- The renderer the chart that will be layed over
the chart this renderer is attached to.
protected abstract void calculateChartData(java.awt.Rectangle gridBounds, java.awt.Rectangle dataBounds)
gridBounds
- The chart grid bounds to paint data within.dataBounds
- The scrolled bounds to calculate the data within.protected abstract void calculateGraphBounds(java.awt.Rectangle bounds)
protected void calculateOverlayBounds(ChartRenderer overlay, int index, java.awt.Rectangle gridBounds, java.awt.Rectangle dataBounds)
overlay
- The overlay chart renderer to calculate bounds for.index
- Index of the overlay chart.gridBounds
- Original grid bounds from the base chart.dataBounds
- Original data bounds from the base chart.protected abstract void checkDataIntegrity()
protected ChartSample checkSelection(java.awt.Point point)
point
- The point to check for.
protected java.awt.Rectangle getLineChartBounds(java.awt.Rectangle dataBounds)
dataBounds
- The original data bounds.public ChartRenderer getOverlayRenderer(int index)
index
- The index of the overlay chart.
protected abstract java.awt.Point getSampleCenter(int sample, int serie)
sample
- Index of the sample.serie
- Serie of the sample.
protected boolean isAnyBelowLabelsOn()
protected boolean isAnyFloatingLabelsOn(int serie)
serie
- The serie to check floating labels for.
Should be set to -1 when checking for all series.protected abstract void paintFloatingLabel(java.awt.Graphics g, java.lang.String label, java.awt.Rectangle gridBounds, int sample, int series, java.awt.Font font, java.awt.FontMetrics fm)
g
- The graphics context to paint with.label
- The label to paint.gridBounds
- The chart grid bounds.sample
- The index of the sample.series
- The index of the series.font
- The font to use for painting.fm
- The font metrics, used to calculate label position.protected boolean paintFloatingLabels(java.awt.Graphics g, java.awt.Rectangle gridBounds)
g
- The graphics context used to paint with.gridBounds
- The chart grid bounds.
protected void paintGrid(java.awt.Graphics g, Grid grid, java.awt.Rectangle gridBounds)
g
- The graphic context used to paint with.grid
- The Grid object to be painted.gridBounds
- The given bounding rectangle.protected void paintSampleHighlight(java.awt.Graphics g, int serie, int sample, int x, int y, java.awt.Color color)
g
- The graphics context used to paint with.serie
- The index of the serie.x
- The x-position of the sample.y
- The y-position of the sample.color
- The color of the sample highlight.public void removeExternalGraphics()
setExternalGraphics(java.awt.Graphics, java.awt.Image)
protected abstract void render(java.awt.Graphics g)
g
- The graphics context used to paint with.GenericChart.paint(java.awt.Graphics)
protected void render(java.awt.Graphics g, boolean offscreenOn)
protected abstract void renderData(java.awt.Graphics g, java.awt.Rectangle gridBounds, java.awt.Rectangle dataBounds)
g
- The graphics context used to paint with.gridBounds
- The chart grid bounds to paint data within.dataBounds
- The scrolled bounds to calculate the data within.public void reset()
public void setExternalGraphics(java.awt.Graphics g, java.awt.Image image)
g
- The graphics context used for painting.image
- The image to which graphics context belongs.
See here for an example.public void setOverlayRenderer(int index, ChartRenderer renderer)
renderer
- The renderer to set for this overlay position.
java.lang.IllegalArgumentException
- If the index is invalid.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |