public class LegendRenderer extends Renderer
chart, DEFAULT_CURSOR, DOUBLE_CLICK_TIME, GRID_CURSOR_HORZ, GRID_CURSOR_VERT, HAND_CURSOR, RESIZE_CURSOR, RESIZE_HOR_CURSOR
Constructor and Description |
---|
LegendRenderer(GenericChart chart)
Creates a legend renderer.
|
Modifier and Type | Method and Description |
---|---|
void |
calculateGraphBounds(Legend legend,
java.awt.Rectangle gridBounds)
This method adjusts the chart grid for the legend.
|
int |
getSelectedElement(java.awt.Point point,
Legend legend)
This method is called when the user releases the mouse and checks
if the given point is inside a sample.
|
void |
handleLegendScrollers(java.awt.AWTEvent event)
Handles the range adjuster and sample scroller.
|
protected void |
paintLegend(java.awt.Graphics g,
Legend legend,
java.awt.Rectangle bounds,
java.lang.String[] labels)
Paints the legend.
|
protected void |
paintLegendElement(java.awt.Graphics g,
Legend legend,
int index,
int xpos,
int ypos,
int height,
java.lang.String label,
java.awt.FontMetrics fm)
Paints the particular legend element.
|
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
public LegendRenderer(GenericChart chart)
chart
- A chart object the legend is set for.public void calculateGraphBounds(Legend legend, java.awt.Rectangle gridBounds)
gridBounds
- The Rectangle object where the bounds to be stored.public int getSelectedElement(java.awt.Point point, Legend legend)
point
- The point to check for.legend
- The legend to paint.public void handleLegendScrollers(java.awt.AWTEvent event)
protected void paintLegend(java.awt.Graphics g, Legend legend, java.awt.Rectangle bounds, java.lang.String[] labels)
g
- The graphics context used to paint with.legend
- The legend to paint.bounds
- The chart grid bounds.labels
- The labels of the legend.protected void paintLegendElement(java.awt.Graphics g, Legend legend, int index, int xpos, int ypos, int height, java.lang.String label, java.awt.FontMetrics fm)
g
- The graphics context used to paint with.legend
- The legend to paint.index
- The index of element inside the legend.xpos
- The x position if the element.ypos
- The y position if the element.label
- The legend label.fm
- The font metrics used to paint label with.