A class for creating shaded contours.
addDomainMarker
public void addDomainMarker(Marker marker)
Adds a marker for the domain axis.
Typically a marker will be drawn by the renderer as a line perpendicular
to the range axis, however this is entirely up to the renderer.
addRangeMarker
public void addRangeMarker(Marker marker)
Adds a marker for the range axis.
Typically a marker will be drawn by the renderer as a line perpendicular
to the range axis, however this is entirely up to the renderer.
clone
public Object clone()
throws CloneNotSupportedException
Extends plot cloning to this plot type
- clone in interface Plot
contourRenderer
public void contourRenderer(Graphics2D g2,
Rectangle2D dataArea,
PlotRenderingInfo info,
ContourPlot plot,
ValueAxis horizontalAxis,
ValueAxis verticalAxis,
ColorBar colorBar,
ContourDataset data,
CrosshairState crosshairState)
Fills the plot.
g2
- the graphics device.dataArea
- the area within which the data is being drawn.info
- collects information about the drawing.plot
- the plot (can be used to obtain standard color
information etc).horizontalAxis
- the domain (horizontal) axis.verticalAxis
- the range (vertical) axis.colorBar
- the color bar axis.data
- the dataset.crosshairState
- information about crosshairs on a plot.
draw
public void draw(Graphics2D g2,
Rectangle2D area,
Point2D anchor,
PlotState parentState,
PlotRenderingInfo info)
Draws the plot on a Java 2D graphics device (such as the screen or a
printer).
The optional
info
argument collects information about the
rendering of the plot (dimensions, tooltip information etc). Just pass
in
null
if you do not need this information.
- draw in interface Plot
g2
- the graphics device.area
- the area within which the plot (including axis labels)
should be drawn.anchor
- the anchor point (null
permitted).parentState
- the state from the parent plot, if there is one.info
- collects chart drawing information (null
permitted).
drawDomainMarker
public void drawDomainMarker(Graphics2D g2,
ContourPlot plot,
ValueAxis domainAxis,
Marker marker,
Rectangle2D dataArea)
Draws a vertical line on the chart to represent a 'range marker'.
g2
- the graphics device.plot
- the plot.domainAxis
- the domain axis.marker
- the marker line.dataArea
- the axis data area.
drawHorizontalLine
protected void drawHorizontalLine(Graphics2D g2,
Rectangle2D dataArea,
double value,
Stroke stroke,
Paint paint)
Utility method for drawing a crosshair on the chart (if required).
g2
- The graphics device.dataArea
- The data area.value
- The coordinate, where to draw the line.stroke
- The stroke to use.paint
- The paint to use.
drawRangeMarker
public void drawRangeMarker(Graphics2D g2,
ContourPlot plot,
ValueAxis rangeAxis,
Marker marker,
Rectangle2D dataArea)
Draws a horizontal line across the chart to represent a 'range marker'.
g2
- the graphics device.plot
- the plot.rangeAxis
- the range axis.marker
- the marker line.dataArea
- the axis data area.
drawVerticalLine
protected void drawVerticalLine(Graphics2D g2,
Rectangle2D dataArea,
double value,
Stroke stroke,
Paint paint)
Utility method for drawing a crosshair on the chart (if required).
g2
- The graphics device.dataArea
- The data area.value
- The coordinate, where to draw the line.stroke
- The stroke to use.paint
- The paint to use.
getDataset
public ContourDataset getDataset()
Returns the primary dataset for the plot.
- The primary dataset (possibly
null
).
getDomainCrosshairStroke
public Stroke getDomainCrosshairStroke()
Returns the Stroke used to draw the crosshair (if visible).
getPlotType
public String getPlotType()
Returns the plot type as a string.
- getPlotType in interface Plot
- A short string describing the type of plot.
getPtSizePct
public double getPtSizePct()
Returns the ptSizePct.
getRangeCrosshairStroke
public Stroke getRangeCrosshairStroke()
Returns the Stroke used to draw the crosshair (if visible).
handleClick
public void handleClick(int x,
int y,
PlotRenderingInfo info)
Handles a 'click' on the plot by updating the anchor values...
- handleClick in interface Plot
x
- x-coordinate, where the click occured.y
- y-coordinate, where the click occured.info
- An object for collection dimension information.
isCompatibleDomainAxis
public boolean isCompatibleDomainAxis(ValueAxis axis)
Checks the compatibility of a domain axis, returning true if the axis is
compatible with the plot, and false otherwise.
axis
- The proposed axis.
true
if the axis is compatible with the plot.
isDomainCrosshairLockedOnData
public boolean isDomainCrosshairLockedOnData()
Returns a flag indicating whether or not the crosshair should "lock-on"
to actual data values.
isDomainCrosshairVisible
public boolean isDomainCrosshairVisible()
Returns a flag indicating whether or not the domain crosshair is visible.
isRangeCrosshairLockedOnData
public boolean isRangeCrosshairLockedOnData()
Returns a flag indicating whether or not the crosshair should "lock-on"
to actual data values.
isRangeCrosshairVisible
public boolean isRangeCrosshairVisible()
Returns a flag indicating whether or not the range crosshair is visible.
pointRenderer
public void pointRenderer(Graphics2D g2,
Rectangle2D dataArea,
PlotRenderingInfo info,
ContourPlot plot,
ValueAxis domainAxis,
ValueAxis rangeAxis,
ColorBar colorBar,
ContourDataset data,
CrosshairState crosshairState)
Draws the visual representation of a single data item.
g2
- the graphics device.dataArea
- the area within which the data is being drawn.info
- collects information about the drawing.plot
- the plot (can be used to obtain standard color
information etc).domainAxis
- the domain (horizontal) axis.rangeAxis
- the range (vertical) axis.colorBar
- the color bar axis.data
- the dataset.crosshairState
- information about crosshairs on a plot.
propertyChange
public void propertyChange(PropertyChangeEvent event)
Notifies all registered listeners of a property change.
One source of property change events is the plot's renderer.
event
- Information about the property change.
render
public void render(Graphics2D g2,
Rectangle2D dataArea,
PlotRenderingInfo info,
CrosshairState crosshairState)
Draws a representation of the data within the dataArea region, using the
current renderer.
The
info
and
crosshairState
arguments may be
null
.
g2
- the graphics device.dataArea
- the region in which the data is to be drawn.info
- an optional object for collection dimension information.crosshairState
- an optional object for collecting crosshair info.
setClipPath
public void setClipPath(ClipPath clipPath)
Sets the clipPath.
clipPath
- The clipPath to set
setColorBarAxis
public void setColorBarAxis(ColorBar axis)
Sets the colorbar for the plot.
axis
- The new axis (null permitted).
setDataAreaRatio
public void setDataAreaRatio(double ratio)
Sets the data area ratio.
setDataset
public void setDataset(ContourDataset dataset)
Sets the dataset for the plot, replacing the existing dataset if there
is one.
dataset
- the dataset (null
permitted).
setDomainAxis
public void setDomainAxis(ValueAxis axis)
Sets the domain axis for the plot (this must be compatible with the plot
type or an exception is thrown).
setDomainCrosshairLockedOnData
public void setDomainCrosshairLockedOnData(boolean flag)
Sets the flag indicating whether or not the domain crosshair should
"lock-on" to actual data values.
setDomainCrosshairPaint
public void setDomainCrosshairPaint(Paint paint)
Sets the Paint used to color the crosshairs (if visible) and notifies
registered listeners that the axis has been modified.
paint
- the new crosshair paint.
setDomainCrosshairStroke
public void setDomainCrosshairStroke(Stroke stroke)
Sets the Stroke used to draw the crosshairs (if visible) and notifies
registered listeners that the axis has been modified.
stroke
- the new crosshair stroke.
setDomainCrosshairValue
public void setDomainCrosshairValue(double value)
Sets the domain crosshair value.
Registered listeners are notified that the plot has been modified, but
only if the crosshair is visible.
setDomainCrosshairValue
public void setDomainCrosshairValue(double value,
boolean notify)
Sets the domain crosshair value.
Registered listeners are notified that the axis has been modified, but
only if the crosshair is visible.
value
- the new value.notify
- a flag that controls whether or not listeners are
notified.
setDomainCrosshairVisible
public void setDomainCrosshairVisible(boolean flag)
Sets the flag indicating whether or not the domain crosshair is visible.
flag
- the new value of the flag.
setMissingPaint
public void setMissingPaint(Paint paint)
Sets the missingPaint.
paint
- the missingPaint to set.
setPtSizePct
public void setPtSizePct(double ptSizePct)
Sets the ptSizePct.
ptSizePct
- The ptSizePct to set
setRangeAxis
public void setRangeAxis(ValueAxis axis)
Sets the range axis for the plot.
An exception is thrown if the new axis and the plot are not mutually
compatible.
axis
- The new axis (null permitted).
setRangeCrosshairLockedOnData
public void setRangeCrosshairLockedOnData(boolean flag)
Sets the flag indicating whether or not the range crosshair should
"lock-on" to actual data values.
setRangeCrosshairPaint
public void setRangeCrosshairPaint(Paint paint)
Sets the Paint used to color the crosshairs (if visible) and notifies
registered listeners that the axis has been modified.
paint
- the new crosshair paint.
setRangeCrosshairStroke
public void setRangeCrosshairStroke(Stroke stroke)
Sets the Stroke used to draw the crosshairs (if visible) and notifies
registered listeners that the axis has been modified.
stroke
- the new crosshair stroke.
setRangeCrosshairValue
public void setRangeCrosshairValue(double value)
Sets the domain crosshair value.
Registered listeners are notified that the plot has been modified, but
only if the crosshair is visible.
setRangeCrosshairValue
public void setRangeCrosshairValue(double value,
boolean notify)
Sets the range crosshair value.
Registered listeners are notified that the axis has been modified, but
only if the crosshair is visible.
value
- the new value.notify
- a flag that controls whether or not listeners are
notified.
setRangeCrosshairVisible
public void setRangeCrosshairVisible(boolean flag)
Sets the flag indicating whether or not the range crosshair is visible.
flag
- the new value of the flag.
setRenderAsPoints
public void setRenderAsPoints(boolean renderAsPoints)
Sets the renderAsPoints.
renderAsPoints
- The renderAsPoints to set
setURLGenerator
public void setURLGenerator(XYURLGenerator urlGenerator)
Sets the URL generator for HTML image maps.
urlGenerator
- the URL generator (null permitted).
zoom
public void zoom(double percent)
Zooms the axis ranges by the specified percentage about the anchor point.
- zoom in interface Plot
percent
- The amount of the zoom.
zoomDomainAxes
public void zoomDomainAxes(double x,
double y,
double factor)
Multiplies the range on the domain axis/axes by the specified factor
(to be implemented).
x
- the x-coordinate (in Java2D space).y
- the y-coordinate (in Java2D space).factor
- the zoom factor.
zoomDomainAxes
public void zoomDomainAxes(double x,
double y,
double lowerPercent,
double upperPercent)
Zooms the domain axes (not yet implemented).
x
- the x-coordinate (in Java2D space).y
- the y-coordinate (in Java2D space).lowerPercent
- the new lower bound.upperPercent
- the new upper bound.
zoomRangeAxes
public void zoomRangeAxes(double x,
double y,
double factor)
Multiplies the range on the range axis/axes by the specified factor.
x
- the x-coordinate (in Java2D space).y
- the y-coordinate (in Java2D space).factor
- the zoom factor.
zoomRangeAxes
public void zoomRangeAxes(double x,
double y,
double lowerPercent,
double upperPercent)
Zooms the range axes (not yet implemented).
x
- the x-coordinate (in Java2D space).y
- the y-coordinate (in Java2D space).lowerPercent
- the new lower bound.upperPercent
- the new upper bound.