|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectXYLineAndShapeRenderer
schmitzm.jfree.chart.renderer.PointSelectionXYRenderer
public class PointSelectionXYRenderer
Extends the XYLineAndShapeRenderer
with the
SelectionRenderer
functionality. Additionally redefines
the drawItem(Graphics2D, XYItemRendererState, Rectangle2D, PlotRenderingInfo, XYPlot, ValueAxis, ValueAxis, XYDataset, int, int, CrosshairState, int)
method to realize the highlight rendering of the selected
items. Only the selected data points are rendered. No lines
ore areas!
Note:
An adequate SeriesDatasetSelectionModel
is automatically
created when a new Plot
is set. Manually calling setSelectionModel(SeriesDatasetSelectionModel)
is usually not necessary. Overwrite createAndSetSelectionModel()
to
avoid this behavior.
If no selection model is set, the behavior of this renderer is exactly
like the super class.
Field Summary | |
---|---|
protected Logger |
LOGGER
Used for log and debug messages. |
protected SeriesDatasetSelectionModel |
selectionModel
Holds the selection model, the renderer uses to determine whether a data item is selected or not. |
protected Paint |
selectionPaint
Holds the selection color for each series. |
Constructor Summary | |
---|---|
PointSelectionXYRenderer()
Creates a new renderer. |
Method Summary | |
---|---|
void |
createAndSetSelectionModel()
Creates and sets an adequate SeriesDatasetSelectionModel
according to the Dataset of the current Plot . |
SeriesDatasetSelectionModel |
createSelectionModel(Dataset dataset)
Creates an adequate SeriesDatasetSelectionModel
according to the given Dataset . |
void |
drawItem(Graphics2D g,
XYItemRendererState state,
Rectangle2D dataArea,
PlotRenderingInfo info,
XYPlot plot,
ValueAxis domainAxis,
ValueAxis rangeAxis,
XYDataset dataset,
int series,
int item,
CrosshairState crosshairState,
int pass)
Sets the rendering color (temporary for the rendering process) to the highlight color, if the item is defined as selected (by the selection model). |
SeriesDatasetSelectionModel |
getSelectionModel()
Returns the selection model the renderer uses to determine whether a data item is selected or not. |
Paint |
getSelectionPaint()
Returns the color, the selected data of the primary series is rendered with. |
protected void |
init()
Called by every constructor to initialize the extensions of this renderer. |
boolean |
isSeriesVisibleInLegend(int series)
Returns always false , so that no series of the selection
renderer is visible in the legend. |
void |
setPlot(XYPlot plot)
Creates and sets a new SeriesDatasetSelectionModel , if no selection model
is set yet, or the selection model's dataset differs from the dataset of the
new plot. |
void |
setSelectionModel(SeriesDatasetSelectionModel model)
Sets the selection model the renderer uses to determine whether a data item is selected or not. |
void |
setSelectionPaint(Paint paint)
Sets the color, the selected data of the primary series is rendered with. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface schmitzm.jfree.chart.selection.DatasetSelectionModelProvider |
---|
setSelectionModel |
Field Detail |
---|
protected Logger LOGGER
protected SeriesDatasetSelectionModel selectionModel
protected Paint selectionPaint
Constructor Detail |
---|
public PointSelectionXYRenderer()
Method Detail |
---|
protected void init()
public boolean isSeriesVisibleInLegend(int series)
false
, so that no series of the selection
renderer is visible in the legend.
public void setSelectionModel(SeriesDatasetSelectionModel model)
model
- the selection modelpublic SeriesDatasetSelectionModel getSelectionModel()
getSelectionModel
in interface DatasetSelectionModelProvider<SeriesDatasetSelectionModel>
public void createAndSetSelectionModel()
SeriesDatasetSelectionModel
according to the Dataset
of the current Plot
. Automatically
called by setPlot(XYPlot)
.null
if the renderer is not
connected to a plot or the plot contains no dataset.
#createSelectionModel(XYDataset)
public SeriesDatasetSelectionModel createSelectionModel(Dataset dataset)
SeriesDatasetSelectionModel
according to the given Dataset
. Subclasses can overwrite this
method to create an alternative SeriesDatasetSelectionModel
.
createSelectionModel
in interface DatasetSelectionModelProvider<SeriesDatasetSelectionModel>
dataset
- must be a XYDataset
IllegalArgumentException
- if dataset
is no XYDataset
public Paint getSelectionPaint()
getSelectionPaint
in interface SelectionRenderer<SeriesDatasetSelectionModel>
null
if no selection color is defined
for the seriespublic void setSelectionPaint(Paint paint)
setSelectionPaint
in interface SelectionRenderer<SeriesDatasetSelectionModel>
paint
- color for the selected datapublic void setPlot(XYPlot plot)
SeriesDatasetSelectionModel
, if no selection model
is set yet, or the selection model's dataset differs from the dataset of the
new plot.
plot
- the plot rendered by this rendererpublic void drawItem(Graphics2D g, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |