| Method from org.jfree.chart.plot.XYPlot Detail: |
public void addAnnotation(XYAnnotation annotation) {
addAnnotation(annotation, true);
}
Adds an annotation to the plot and sends a PlotChangeEvent to
all registered listeners. |
public void addAnnotation(XYAnnotation annotation,
boolean notify) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
this.annotations.add(annotation);
if (notify) {
fireChangeEvent();
}
}
Adds an annotation to the plot and, if requested, sends a
PlotChangeEvent to all registered listeners. |
public void addDomainMarker(Marker marker) {
// defer argument checking...
addDomainMarker(marker, Layer.FOREGROUND);
}
Adds a marker for the domain axis and sends a PlotChangeEvent
to all registered listeners.
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. |
public void addDomainMarker(Marker marker,
Layer layer) {
addDomainMarker(0, marker, layer);
}
Adds a marker for the domain axis in the specified layer and sends a
PlotChangeEvent to all registered listeners.
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. |
public void addDomainMarker(int index,
Marker marker,
Layer layer) {
addDomainMarker(index, marker, layer, true);
}
Adds a marker for a specific dataset/renderer and sends a
PlotChangeEvent to all registered listeners.
Typically a marker will be drawn by the renderer as a line perpendicular
to the domain axis (that the renderer is mapped to), however this is
entirely up to the renderer. |
public void addDomainMarker(int index,
Marker marker,
Layer layer,
boolean notify) {
if (marker == null) {
throw new IllegalArgumentException("Null 'marker' not permitted.");
}
if (layer == null) {
throw new IllegalArgumentException("Null 'layer' not permitted.");
}
Collection markers;
if (layer == Layer.FOREGROUND) {
markers = (Collection) this.foregroundDomainMarkers.get(
new Integer(index));
if (markers == null) {
markers = new java.util.ArrayList();
this.foregroundDomainMarkers.put(new Integer(index), markers);
}
markers.add(marker);
}
else if (layer == Layer.BACKGROUND) {
markers = (Collection) this.backgroundDomainMarkers.get(
new Integer(index));
if (markers == null) {
markers = new java.util.ArrayList();
this.backgroundDomainMarkers.put(new Integer(index), markers);
}
markers.add(marker);
}
marker.addChangeListener(this);
if (notify) {
fireChangeEvent();
}
}
Adds a marker for a specific dataset/renderer and, if requested, sends a
PlotChangeEvent to all registered listeners.
Typically a marker will be drawn by the renderer as a line perpendicular
to the domain axis (that the renderer is mapped to), however this is
entirely up to the renderer. |
public void addRangeMarker(Marker marker) {
addRangeMarker(marker, Layer.FOREGROUND);
}
Adds a marker for the range axis and sends a PlotChangeEvent to
all registered listeners.
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. |
public void addRangeMarker(Marker marker,
Layer layer) {
addRangeMarker(0, marker, layer);
}
Adds a marker for the range axis in the specified layer and sends a
PlotChangeEvent to all registered listeners.
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. |
public void addRangeMarker(int index,
Marker marker,
Layer layer) {
addRangeMarker(index, marker, layer, true);
}
Adds a marker for a specific dataset/renderer and sends a
PlotChangeEvent to all registered listeners.
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. |
public void addRangeMarker(int index,
Marker marker,
Layer layer,
boolean notify) {
Collection markers;
if (layer == Layer.FOREGROUND) {
markers = (Collection) this.foregroundRangeMarkers.get(
new Integer(index));
if (markers == null) {
markers = new java.util.ArrayList();
this.foregroundRangeMarkers.put(new Integer(index), markers);
}
markers.add(marker);
}
else if (layer == Layer.BACKGROUND) {
markers = (Collection) this.backgroundRangeMarkers.get(
new Integer(index));
if (markers == null) {
markers = new java.util.ArrayList();
this.backgroundRangeMarkers.put(new Integer(index), markers);
}
markers.add(marker);
}
marker.addChangeListener(this);
if (notify) {
fireChangeEvent();
}
}
Adds a marker for a specific dataset/renderer and, if requested, sends a
PlotChangeEvent to all registered listeners.
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. |
protected AxisSpace calculateAxisSpace(Graphics2D g2,
Rectangle2D plotArea) {
AxisSpace space = new AxisSpace();
space = calculateRangeAxisSpace(g2, plotArea, space);
Rectangle2D revPlotArea = space.shrink(plotArea, null);
space = calculateDomainAxisSpace(g2, revPlotArea, space);
return space;
}
Calculates the space required for all the axes in the plot. |
protected AxisSpace calculateDomainAxisSpace(Graphics2D g2,
Rectangle2D plotArea,
AxisSpace space) {
if (space == null) {
space = new AxisSpace();
}
// reserve some space for the domain axis...
if (this.fixedDomainAxisSpace != null) {
if (this.orientation == PlotOrientation.HORIZONTAL) {
space.ensureAtLeast(this.fixedDomainAxisSpace.getLeft(),
RectangleEdge.LEFT);
space.ensureAtLeast(this.fixedDomainAxisSpace.getRight(),
RectangleEdge.RIGHT);
}
else if (this.orientation == PlotOrientation.VERTICAL) {
space.ensureAtLeast(this.fixedDomainAxisSpace.getTop(),
RectangleEdge.TOP);
space.ensureAtLeast(this.fixedDomainAxisSpace.getBottom(),
RectangleEdge.BOTTOM);
}
}
else {
// reserve space for the domain axes...
for (int i = 0; i < this.domainAxes.size(); i++) {
Axis axis = (Axis) this.domainAxes.get(i);
if (axis != null) {
RectangleEdge edge = getDomainAxisEdge(i);
space = axis.reserveSpace(g2, this, plotArea, edge, space);
}
}
}
return space;
}
Calculates the space required for the domain axis/axes. |
protected AxisSpace calculateRangeAxisSpace(Graphics2D g2,
Rectangle2D plotArea,
AxisSpace space) {
if (space == null) {
space = new AxisSpace();
}
// reserve some space for the range axis...
if (this.fixedRangeAxisSpace != null) {
if (this.orientation == PlotOrientation.HORIZONTAL) {
space.ensureAtLeast(this.fixedRangeAxisSpace.getTop(),
RectangleEdge.TOP);
space.ensureAtLeast(this.fixedRangeAxisSpace.getBottom(),
RectangleEdge.BOTTOM);
}
else if (this.orientation == PlotOrientation.VERTICAL) {
space.ensureAtLeast(this.fixedRangeAxisSpace.getLeft(),
RectangleEdge.LEFT);
space.ensureAtLeast(this.fixedRangeAxisSpace.getRight(),
RectangleEdge.RIGHT);
}
}
else {
// reserve space for the range axes...
for (int i = 0; i < this.rangeAxes.size(); i++) {
Axis axis = (Axis) this.rangeAxes.get(i);
if (axis != null) {
RectangleEdge edge = getRangeAxisEdge(i);
space = axis.reserveSpace(g2, this, plotArea, edge, space);
}
}
}
return space;
}
Calculates the space required for the range axis/axes. |
public void clearAnnotations() {
this.annotations.clear();
fireChangeEvent();
}
Clears all the annotations and sends a PlotChangeEvent to all
registered listeners. |
public void clearDomainAxes() {
for (int i = 0; i < this.domainAxes.size(); i++) {
ValueAxis axis = (ValueAxis) this.domainAxes.get(i);
if (axis != null) {
axis.removeChangeListener(this);
}
}
this.domainAxes.clear();
fireChangeEvent();
}
Clears the domain axes from the plot and sends a PlotChangeEvent
to all registered listeners. |
public void clearDomainMarkers() {
if (this.backgroundDomainMarkers != null) {
Set keys = this.backgroundDomainMarkers.keySet();
Iterator iterator = keys.iterator();
while (iterator.hasNext()) {
Integer key = (Integer) iterator.next();
clearDomainMarkers(key.intValue());
}
this.backgroundDomainMarkers.clear();
}
if (this.foregroundDomainMarkers != null) {
Set keys = this.foregroundDomainMarkers.keySet();
Iterator iterator = keys.iterator();
while (iterator.hasNext()) {
Integer key = (Integer) iterator.next();
clearDomainMarkers(key.intValue());
}
this.foregroundDomainMarkers.clear();
}
fireChangeEvent();
}
Clears all the (foreground and background) domain markers and sends a
PlotChangeEvent to all registered listeners. |
public void clearDomainMarkers(int index) {
Integer key = new Integer(index);
if (this.backgroundDomainMarkers != null) {
Collection markers
= (Collection) this.backgroundDomainMarkers.get(key);
if (markers != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker m = (Marker) iterator.next();
m.removeChangeListener(this);
}
markers.clear();
}
}
if (this.foregroundRangeMarkers != null) {
Collection markers
= (Collection) this.foregroundDomainMarkers.get(key);
if (markers != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker m = (Marker) iterator.next();
m.removeChangeListener(this);
}
markers.clear();
}
}
fireChangeEvent();
}
Clears the (foreground and background) domain markers for a particular
renderer. |
public void clearRangeAxes() {
for (int i = 0; i < this.rangeAxes.size(); i++) {
ValueAxis axis = (ValueAxis) this.rangeAxes.get(i);
if (axis != null) {
axis.removeChangeListener(this);
}
}
this.rangeAxes.clear();
fireChangeEvent();
}
Clears the range axes from the plot and sends a PlotChangeEvent
to all registered listeners. |
public void clearRangeMarkers() {
if (this.backgroundRangeMarkers != null) {
Set keys = this.backgroundRangeMarkers.keySet();
Iterator iterator = keys.iterator();
while (iterator.hasNext()) {
Integer key = (Integer) iterator.next();
clearRangeMarkers(key.intValue());
}
this.backgroundRangeMarkers.clear();
}
if (this.foregroundRangeMarkers != null) {
Set keys = this.foregroundRangeMarkers.keySet();
Iterator iterator = keys.iterator();
while (iterator.hasNext()) {
Integer key = (Integer) iterator.next();
clearRangeMarkers(key.intValue());
}
this.foregroundRangeMarkers.clear();
}
fireChangeEvent();
}
Clears all the range markers and sends a PlotChangeEvent to all
registered listeners. |
public void clearRangeMarkers(int index) {
Integer key = new Integer(index);
if (this.backgroundRangeMarkers != null) {
Collection markers
= (Collection) this.backgroundRangeMarkers.get(key);
if (markers != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker m = (Marker) iterator.next();
m.removeChangeListener(this);
}
markers.clear();
}
}
if (this.foregroundRangeMarkers != null) {
Collection markers
= (Collection) this.foregroundRangeMarkers.get(key);
if (markers != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker m = (Marker) iterator.next();
m.removeChangeListener(this);
}
markers.clear();
}
}
fireChangeEvent();
}
Clears the (foreground and background) range markers for a particular
renderer. |
public Object clone() throws CloneNotSupportedException {
XYPlot clone = (XYPlot) super.clone();
clone.domainAxes = (ObjectList) ObjectUtilities.clone(this.domainAxes);
for (int i = 0; i < this.domainAxes.size(); i++) {
ValueAxis axis = (ValueAxis) this.domainAxes.get(i);
if (axis != null) {
ValueAxis clonedAxis = (ValueAxis) axis.clone();
clone.domainAxes.set(i, clonedAxis);
clonedAxis.setPlot(clone);
clonedAxis.addChangeListener(clone);
}
}
clone.domainAxisLocations = (ObjectList)
this.domainAxisLocations.clone();
clone.rangeAxes = (ObjectList) ObjectUtilities.clone(this.rangeAxes);
for (int i = 0; i < this.rangeAxes.size(); i++) {
ValueAxis axis = (ValueAxis) this.rangeAxes.get(i);
if (axis != null) {
ValueAxis clonedAxis = (ValueAxis) axis.clone();
clone.rangeAxes.set(i, clonedAxis);
clonedAxis.setPlot(clone);
clonedAxis.addChangeListener(clone);
}
}
clone.rangeAxisLocations = (ObjectList) ObjectUtilities.clone(
this.rangeAxisLocations);
// the datasets are not cloned, but listeners need to be added...
clone.datasets = (ObjectList) ObjectUtilities.clone(this.datasets);
for (int i = 0; i < clone.datasets.size(); ++i) {
XYDataset d = getDataset(i);
if (d != null) {
d.addChangeListener(clone);
}
}
clone.datasetToDomainAxisMap = new TreeMap();
clone.datasetToDomainAxisMap.putAll(this.datasetToDomainAxisMap);
clone.datasetToRangeAxisMap = new TreeMap();
clone.datasetToRangeAxisMap.putAll(this.datasetToRangeAxisMap);
clone.renderers = (ObjectList) ObjectUtilities.clone(this.renderers);
for (int i = 0; i < this.renderers.size(); i++) {
XYItemRenderer renderer2 = (XYItemRenderer) this.renderers.get(i);
if (renderer2 instanceof PublicCloneable) {
PublicCloneable pc = (PublicCloneable) renderer2;
clone.renderers.set(i, pc.clone());
}
}
clone.foregroundDomainMarkers = (Map) ObjectUtilities.clone(
this.foregroundDomainMarkers);
clone.backgroundDomainMarkers = (Map) ObjectUtilities.clone(
this.backgroundDomainMarkers);
clone.foregroundRangeMarkers = (Map) ObjectUtilities.clone(
this.foregroundRangeMarkers);
clone.backgroundRangeMarkers = (Map) ObjectUtilities.clone(
this.backgroundRangeMarkers);
clone.annotations = (List) ObjectUtilities.deepClone(this.annotations);
if (this.fixedDomainAxisSpace != null) {
clone.fixedDomainAxisSpace = (AxisSpace) ObjectUtilities.clone(
this.fixedDomainAxisSpace);
}
if (this.fixedRangeAxisSpace != null) {
clone.fixedRangeAxisSpace = (AxisSpace) ObjectUtilities.clone(
this.fixedRangeAxisSpace);
}
clone.quadrantOrigin = (Point2D) ObjectUtilities.clone(
this.quadrantOrigin);
clone.quadrantPaint = (Paint[]) this.quadrantPaint.clone();
return clone;
}
Returns a clone of the plot. |
public void configureDomainAxes() {
for (int i = 0; i < this.domainAxes.size(); i++) {
ValueAxis axis = (ValueAxis) this.domainAxes.get(i);
if (axis != null) {
axis.configure();
}
}
}
Configures the domain axes. |
public void configureRangeAxes() {
for (int i = 0; i < this.rangeAxes.size(); i++) {
ValueAxis axis = (ValueAxis) this.rangeAxes.get(i);
if (axis != null) {
axis.configure();
}
}
}
Configures the range axes. |
public void datasetChanged(DatasetChangeEvent event) {
configureDomainAxes();
configureRangeAxes();
if (getParent() != null) {
getParent().datasetChanged(event);
}
else {
PlotChangeEvent e = new PlotChangeEvent(this);
e.setType(ChartChangeEventType.DATASET_UPDATED);
notifyListeners(e);
}
}
|
public void draw(Graphics2D g2,
Rectangle2D area,
Point2D anchor,
PlotState parentState,
PlotRenderingInfo info) {
// if the plot area is too small, just return...
boolean b1 = (area.getWidth() < = MINIMUM_WIDTH_TO_DRAW);
boolean b2 = (area.getHeight() < = MINIMUM_HEIGHT_TO_DRAW);
if (b1 || b2) {
return;
}
// record the plot area...
if (info != null) {
info.setPlotArea(area);
}
// adjust the drawing area for the plot insets (if any)...
RectangleInsets insets = getInsets();
insets.trim(area);
AxisSpace space = calculateAxisSpace(g2, area);
Rectangle2D dataArea = space.shrink(area, null);
this.axisOffset.trim(dataArea);
if (info != null) {
info.setDataArea(dataArea);
}
// draw the plot background and axes...
drawBackground(g2, dataArea);
Map axisStateMap = drawAxes(g2, area, dataArea, info);
PlotOrientation orient = getOrientation();
// the anchor point is typically the point where the mouse last
// clicked - the crosshairs will be driven off this point...
if (anchor != null && !dataArea.contains(anchor)) {
anchor = null;
}
CrosshairState crosshairState = new CrosshairState();
crosshairState.setCrosshairDistance(Double.POSITIVE_INFINITY);
crosshairState.setAnchor(anchor);
crosshairState.setAnchorX(Double.NaN);
crosshairState.setAnchorY(Double.NaN);
if (anchor != null) {
ValueAxis domainAxis = getDomainAxis();
if (domainAxis != null) {
double x;
if (orient == PlotOrientation.VERTICAL) {
x = domainAxis.java2DToValue(anchor.getX(), dataArea,
getDomainAxisEdge());
}
else {
x = domainAxis.java2DToValue(anchor.getY(), dataArea,
getDomainAxisEdge());
}
crosshairState.setAnchorX(x);
}
ValueAxis rangeAxis = getRangeAxis();
if (rangeAxis != null) {
double y;
if (orient == PlotOrientation.VERTICAL) {
y = rangeAxis.java2DToValue(anchor.getY(), dataArea,
getRangeAxisEdge());
}
else {
y = rangeAxis.java2DToValue(anchor.getX(), dataArea,
getRangeAxisEdge());
}
crosshairState.setAnchorY(y);
}
}
crosshairState.setCrosshairX(getDomainCrosshairValue());
crosshairState.setCrosshairY(getRangeCrosshairValue());
Shape originalClip = g2.getClip();
Composite originalComposite = g2.getComposite();
g2.clip(dataArea);
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
getForegroundAlpha()));
AxisState domainAxisState = (AxisState) axisStateMap.get(
getDomainAxis());
if (domainAxisState == null) {
if (parentState != null) {
domainAxisState = (AxisState) parentState.getSharedAxisStates()
.get(getDomainAxis());
}
}
AxisState rangeAxisState = (AxisState) axisStateMap.get(getRangeAxis());
if (rangeAxisState == null) {
if (parentState != null) {
rangeAxisState = (AxisState) parentState.getSharedAxisStates()
.get(getRangeAxis());
}
}
if (domainAxisState != null) {
drawDomainTickBands(g2, dataArea, domainAxisState.getTicks());
}
if (rangeAxisState != null) {
drawRangeTickBands(g2, dataArea, rangeAxisState.getTicks());
}
if (domainAxisState != null) {
drawDomainGridlines(g2, dataArea, domainAxisState.getTicks());
drawZeroDomainBaseline(g2, dataArea);
}
if (rangeAxisState != null) {
drawRangeGridlines(g2, dataArea, rangeAxisState.getTicks());
drawZeroRangeBaseline(g2, dataArea);
}
// draw the markers that are associated with a specific renderer...
for (int i = 0; i < this.renderers.size(); i++) {
drawDomainMarkers(g2, dataArea, i, Layer.BACKGROUND);
}
for (int i = 0; i < this.renderers.size(); i++) {
drawRangeMarkers(g2, dataArea, i, Layer.BACKGROUND);
}
// now draw annotations and render data items...
boolean foundData = false;
DatasetRenderingOrder order = getDatasetRenderingOrder();
if (order == DatasetRenderingOrder.FORWARD) {
// draw background annotations
int rendererCount = this.renderers.size();
for (int i = 0; i < rendererCount; i++) {
XYItemRenderer r = getRenderer(i);
if (r != null) {
ValueAxis domainAxis = getDomainAxisForDataset(i);
ValueAxis rangeAxis = getRangeAxisForDataset(i);
r.drawAnnotations(g2, dataArea, domainAxis, rangeAxis,
Layer.BACKGROUND, info);
}
}
// render data items...
for (int i = 0; i < getDatasetCount(); i++) {
foundData = render(g2, dataArea, i, info, crosshairState)
|| foundData;
}
// draw foreground annotations
for (int i = 0; i < rendererCount; i++) {
XYItemRenderer r = getRenderer(i);
if (r != null) {
ValueAxis domainAxis = getDomainAxisForDataset(i);
ValueAxis rangeAxis = getRangeAxisForDataset(i);
r.drawAnnotations(g2, dataArea, domainAxis, rangeAxis,
Layer.FOREGROUND, info);
}
}
}
else if (order == DatasetRenderingOrder.REVERSE) {
// draw background annotations
int rendererCount = this.renderers.size();
for (int i = rendererCount - 1; i >= 0; i--) {
XYItemRenderer r = getRenderer(i);
if (i >= getDatasetCount()) { // we need the dataset to make
continue; // a link to the axes
}
if (r != null) {
ValueAxis domainAxis = getDomainAxisForDataset(i);
ValueAxis rangeAxis = getRangeAxisForDataset(i);
r.drawAnnotations(g2, dataArea, domainAxis, rangeAxis,
Layer.BACKGROUND, info);
}
}
for (int i = getDatasetCount() - 1; i >= 0; i--) {
foundData = render(g2, dataArea, i, info, crosshairState)
|| foundData;
}
// draw foreground annotations
for (int i = rendererCount - 1; i >= 0; i--) {
XYItemRenderer r = getRenderer(i);
if (i >= getDatasetCount()) { // we need the dataset to make
continue; // a link to the axes
}
if (r != null) {
ValueAxis domainAxis = getDomainAxisForDataset(i);
ValueAxis rangeAxis = getRangeAxisForDataset(i);
r.drawAnnotations(g2, dataArea, domainAxis, rangeAxis,
Layer.FOREGROUND, info);
}
}
}
// draw domain crosshair if required...
int xAxisIndex = crosshairState.getDomainAxisIndex();
ValueAxis xAxis = getDomainAxis(xAxisIndex);
RectangleEdge xAxisEdge = getDomainAxisEdge(xAxisIndex);
if (!this.domainCrosshairLockedOnData && anchor != null) {
double xx;
if (orient == PlotOrientation.VERTICAL) {
xx = xAxis.java2DToValue(anchor.getX(), dataArea, xAxisEdge);
}
else {
xx = xAxis.java2DToValue(anchor.getY(), dataArea, xAxisEdge);
}
crosshairState.setCrosshairX(xx);
}
setDomainCrosshairValue(crosshairState.getCrosshairX(), false);
if (isDomainCrosshairVisible()) {
double x = getDomainCrosshairValue();
Paint paint = getDomainCrosshairPaint();
Stroke stroke = getDomainCrosshairStroke();
drawDomainCrosshair(g2, dataArea, orient, x, xAxis, stroke, paint);
}
// draw range crosshair if required...
int yAxisIndex = crosshairState.getRangeAxisIndex();
ValueAxis yAxis = getRangeAxis(yAxisIndex);
RectangleEdge yAxisEdge = getRangeAxisEdge(yAxisIndex);
if (!this.rangeCrosshairLockedOnData && anchor != null) {
double yy;
if (orient == PlotOrientation.VERTICAL) {
yy = yAxis.java2DToValue(anchor.getY(), dataArea, yAxisEdge);
} else {
yy = yAxis.java2DToValue(anchor.getX(), dataArea, yAxisEdge);
}
crosshairState.setCrosshairY(yy);
}
setRangeCrosshairValue(crosshairState.getCrosshairY(), false);
if (isRangeCrosshairVisible()) {
double y = getRangeCrosshairValue();
Paint paint = getRangeCrosshairPaint();
Stroke stroke = getRangeCrosshairStroke();
drawRangeCrosshair(g2, dataArea, orient, y, yAxis, stroke, paint);
}
if (!foundData) {
drawNoDataMessage(g2, dataArea);
}
for (int i = 0; i < this.renderers.size(); i++) {
drawDomainMarkers(g2, dataArea, i, Layer.FOREGROUND);
}
for (int i = 0; i < this.renderers.size(); i++) {
drawRangeMarkers(g2, dataArea, i, Layer.FOREGROUND);
}
drawAnnotations(g2, dataArea, info);
g2.setClip(originalClip);
g2.setComposite(originalComposite);
drawOutline(g2, dataArea);
}
Draws the plot within the specified area on a graphics device. |
public void drawAnnotations(Graphics2D g2,
Rectangle2D dataArea,
PlotRenderingInfo info) {
Iterator iterator = this.annotations.iterator();
while (iterator.hasNext()) {
XYAnnotation annotation = (XYAnnotation) iterator.next();
ValueAxis xAxis = getDomainAxis();
ValueAxis yAxis = getRangeAxis();
annotation.draw(g2, this, dataArea, xAxis, yAxis, 0, info);
}
}
Draws the annotations for the plot. |
protected Map drawAxes(Graphics2D g2,
Rectangle2D plotArea,
Rectangle2D dataArea,
PlotRenderingInfo plotState) {
AxisCollection axisCollection = new AxisCollection();
// add domain axes to lists...
for (int index = 0; index < this.domainAxes.size(); index++) {
ValueAxis axis = (ValueAxis) this.domainAxes.get(index);
if (axis != null) {
axisCollection.add(axis, getDomainAxisEdge(index));
}
}
// add range axes to lists...
for (int index = 0; index < this.rangeAxes.size(); index++) {
ValueAxis yAxis = (ValueAxis) this.rangeAxes.get(index);
if (yAxis != null) {
axisCollection.add(yAxis, getRangeAxisEdge(index));
}
}
Map axisStateMap = new HashMap();
// draw the top axes
double cursor = dataArea.getMinY() - this.axisOffset.calculateTopOutset(
dataArea.getHeight());
Iterator iterator = axisCollection.getAxesAtTop().iterator();
while (iterator.hasNext()) {
ValueAxis axis = (ValueAxis) iterator.next();
AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
RectangleEdge.TOP, plotState);
cursor = info.getCursor();
axisStateMap.put(axis, info);
}
// draw the bottom axes
cursor = dataArea.getMaxY()
+ this.axisOffset.calculateBottomOutset(dataArea.getHeight());
iterator = axisCollection.getAxesAtBottom().iterator();
while (iterator.hasNext()) {
ValueAxis axis = (ValueAxis) iterator.next();
AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
RectangleEdge.BOTTOM, plotState);
cursor = info.getCursor();
axisStateMap.put(axis, info);
}
// draw the left axes
cursor = dataArea.getMinX()
- this.axisOffset.calculateLeftOutset(dataArea.getWidth());
iterator = axisCollection.getAxesAtLeft().iterator();
while (iterator.hasNext()) {
ValueAxis axis = (ValueAxis) iterator.next();
AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
RectangleEdge.LEFT, plotState);
cursor = info.getCursor();
axisStateMap.put(axis, info);
}
// draw the right axes
cursor = dataArea.getMaxX()
+ this.axisOffset.calculateRightOutset(dataArea.getWidth());
iterator = axisCollection.getAxesAtRight().iterator();
while (iterator.hasNext()) {
ValueAxis axis = (ValueAxis) iterator.next();
AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
RectangleEdge.RIGHT, plotState);
cursor = info.getCursor();
axisStateMap.put(axis, info);
}
return axisStateMap;
}
A utility method for drawing the axes. |
public void drawBackground(Graphics2D g2,
Rectangle2D area) {
fillBackground(g2, area, this.orientation);
drawQuadrants(g2, area);
drawBackgroundImage(g2, area);
}
Draws the background for the plot. |
protected void drawDomainCrosshair(Graphics2D g2,
Rectangle2D dataArea,
PlotOrientation orientation,
double value,
ValueAxis axis,
Stroke stroke,
Paint paint) {
if (axis.getRange().contains(value)) {
Line2D line = null;
if (orientation == PlotOrientation.VERTICAL) {
double xx = axis.valueToJava2D(value, dataArea,
RectangleEdge.BOTTOM);
line = new Line2D.Double(xx, dataArea.getMinY(), xx,
dataArea.getMaxY());
}
else {
double yy = axis.valueToJava2D(value, dataArea,
RectangleEdge.LEFT);
line = new Line2D.Double(dataArea.getMinX(), yy,
dataArea.getMaxX(), yy);
}
g2.setStroke(stroke);
g2.setPaint(paint);
g2.draw(line);
}
}
Draws a domain crosshair. |
protected void drawDomainGridlines(Graphics2D g2,
Rectangle2D dataArea,
List ticks) {
// no renderer, no gridlines...
if (getRenderer() == null) {
return;
}
// draw the domain grid lines, if any...
if (isDomainGridlinesVisible()) {
Stroke gridStroke = getDomainGridlineStroke();
Paint gridPaint = getDomainGridlinePaint();
if ((gridStroke != null) && (gridPaint != null)) {
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
ValueTick tick = (ValueTick) iterator.next();
getRenderer().drawDomainGridLine(g2, this, getDomainAxis(),
dataArea, tick.getValue());
}
}
}
}
Draws the gridlines for the plot, if they are visible. |
protected void drawDomainMarkers(Graphics2D g2,
Rectangle2D dataArea,
int index,
Layer layer) {
XYItemRenderer r = getRenderer(index);
if (r == null) {
return;
}
// check that the renderer has a corresponding dataset (it doesn't
// matter if the dataset is null)
if (index >= getDatasetCount()) {
return;
}
Collection markers = getDomainMarkers(index, layer);
ValueAxis axis = getDomainAxisForDataset(index);
if (markers != null && axis != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker marker = (Marker) iterator.next();
r.drawDomainMarker(g2, this, axis, marker, dataArea);
}
}
}
Draws the domain markers (if any) for an axis and layer. This method is
typically called from within the draw() method. |
public void drawDomainTickBands(Graphics2D g2,
Rectangle2D dataArea,
List ticks) {
Paint bandPaint = getDomainTickBandPaint();
if (bandPaint != null) {
boolean fillBand = false;
ValueAxis xAxis = getDomainAxis();
double previous = xAxis.getLowerBound();
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
ValueTick tick = (ValueTick) iterator.next();
double current = tick.getValue();
if (fillBand) {
getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
previous, current);
}
previous = current;
fillBand = !fillBand;
}
double end = xAxis.getUpperBound();
if (fillBand) {
getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
previous, end);
}
}
}
Draws the domain tick bands, if any. |
protected void drawHorizontalLine(Graphics2D g2,
Rectangle2D dataArea,
double value,
Stroke stroke,
Paint paint) {
ValueAxis axis = getRangeAxis();
if (getOrientation() == PlotOrientation.HORIZONTAL) {
axis = getDomainAxis();
}
if (axis.getRange().contains(value)) {
double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT);
Line2D line = new Line2D.Double(dataArea.getMinX(), yy,
dataArea.getMaxX(), yy);
g2.setStroke(stroke);
g2.setPaint(paint);
g2.draw(line);
}
}
Utility method for drawing a horizontal line across the data area of the
plot. |
protected void drawQuadrants(Graphics2D g2,
Rectangle2D area) {
// 0 | 1
// --+--
// 2 | 3
boolean somethingToDraw = false;
ValueAxis xAxis = getDomainAxis();
double x = xAxis.getRange().constrain(this.quadrantOrigin.getX());
double xx = xAxis.valueToJava2D(x, area, getDomainAxisEdge());
ValueAxis yAxis = getRangeAxis();
double y = yAxis.getRange().constrain(this.quadrantOrigin.getY());
double yy = yAxis.valueToJava2D(y, area, getRangeAxisEdge());
double xmin = xAxis.getLowerBound();
double xxmin = xAxis.valueToJava2D(xmin, area, getDomainAxisEdge());
double xmax = xAxis.getUpperBound();
double xxmax = xAxis.valueToJava2D(xmax, area, getDomainAxisEdge());
double ymin = yAxis.getLowerBound();
double yymin = yAxis.valueToJava2D(ymin, area, getRangeAxisEdge());
double ymax = yAxis.getUpperBound();
double yymax = yAxis.valueToJava2D(ymax, area, getRangeAxisEdge());
Rectangle2D[] r = new Rectangle2D[] {null, null, null, null};
if (this.quadrantPaint[0] != null) {
if (x > xmin && y < ymax) {
if (this.orientation == PlotOrientation.HORIZONTAL) {
r[0] = new Rectangle2D.Double(Math.min(yymax, yy),
Math.min(xxmin, xx), Math.abs(yy - yymax),
Math.abs(xx - xxmin)
);
}
else { // PlotOrientation.VERTICAL
r[0] = new Rectangle2D.Double(Math.min(xxmin, xx),
Math.min(yymax, yy), Math.abs(xx - xxmin),
Math.abs(yy - yymax));
}
somethingToDraw = true;
}
}
if (this.quadrantPaint[1] != null) {
if (x < xmax && y < ymax) {
if (this.orientation == PlotOrientation.HORIZONTAL) {
r[1] = new Rectangle2D.Double(Math.min(yymax, yy),
Math.min(xxmax, xx), Math.abs(yy - yymax),
Math.abs(xx - xxmax));
}
else { // PlotOrientation.VERTICAL
r[1] = new Rectangle2D.Double(Math.min(xx, xxmax),
Math.min(yymax, yy), Math.abs(xx - xxmax),
Math.abs(yy - yymax));
}
somethingToDraw = true;
}
}
if (this.quadrantPaint[2] != null) {
if (x > xmin && y > ymin) {
if (this.orientation == PlotOrientation.HORIZONTAL) {
r[2] = new Rectangle2D.Double(Math.min(yymin, yy),
Math.min(xxmin, xx), Math.abs(yy - yymin),
Math.abs(xx - xxmin));
}
else { // PlotOrientation.VERTICAL
r[2] = new Rectangle2D.Double(Math.min(xxmin, xx),
Math.min(yymin, yy), Math.abs(xx - xxmin),
Math.abs(yy - yymin));
}
somethingToDraw = true;
}
}
if (this.quadrantPaint[3] != null) {
if (x < xmax && y > ymin) {
if (this.orientation == PlotOrientation.HORIZONTAL) {
r[3] = new Rectangle2D.Double(Math.min(yymin, yy),
Math.min(xxmax, xx), Math.abs(yy - yymin),
Math.abs(xx - xxmax));
}
else { // PlotOrientation.VERTICAL
r[3] = new Rectangle2D.Double(Math.min(xx, xxmax),
Math.min(yymin, yy), Math.abs(xx - xxmax),
Math.abs(yy - yymin));
}
somethingToDraw = true;
}
}
if (somethingToDraw) {
Composite originalComposite = g2.getComposite();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
getBackgroundAlpha()));
for (int i = 0; i < 4; i++) {
if (this.quadrantPaint[i] != null && r[i] != null) {
g2.setPaint(this.quadrantPaint[i]);
g2.fill(r[i]);
}
}
g2.setComposite(originalComposite);
}
}
|
protected void drawRangeCrosshair(Graphics2D g2,
Rectangle2D dataArea,
PlotOrientation orientation,
double value,
ValueAxis axis,
Stroke stroke,
Paint paint) {
if (axis.getRange().contains(value)) {
Line2D line = null;
if (orientation == PlotOrientation.HORIZONTAL) {
double xx = axis.valueToJava2D(value, dataArea,
RectangleEdge.BOTTOM);
line = new Line2D.Double(xx, dataArea.getMinY(), xx,
dataArea.getMaxY());
}
else {
double yy = axis.valueToJava2D(value, dataArea,
RectangleEdge.LEFT);
line = new Line2D.Double(dataArea.getMinX(), yy,
dataArea.getMaxX(), yy);
}
g2.setStroke(stroke);
g2.setPaint(paint);
g2.draw(line);
}
}
|
protected void drawRangeGridlines(Graphics2D g2,
Rectangle2D area,
List ticks) {
// no renderer, no gridlines...
if (getRenderer() == null) {
return;
}
// draw the range grid lines, if any...
if (isRangeGridlinesVisible()) {
Stroke gridStroke = getRangeGridlineStroke();
Paint gridPaint = getRangeGridlinePaint();
ValueAxis axis = getRangeAxis();
if (axis != null) {
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
ValueTick tick = (ValueTick) iterator.next();
if (tick.getValue() != 0.0
|| !isRangeZeroBaselineVisible()) {
getRenderer().drawRangeLine(g2, this, getRangeAxis(),
area, tick.getValue(), gridPaint, gridStroke);
}
}
}
}
}
Draws the gridlines for the plot's primary range axis, if they are
visible. |
protected void drawRangeMarkers(Graphics2D g2,
Rectangle2D dataArea,
int index,
Layer layer) {
XYItemRenderer r = getRenderer(index);
if (r == null) {
return;
}
// check that the renderer has a corresponding dataset (it doesn't
// matter if the dataset is null)
if (index >= getDatasetCount()) {
return;
}
Collection markers = getRangeMarkers(index, layer);
ValueAxis axis = getRangeAxisForDataset(index);
if (markers != null && axis != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker marker = (Marker) iterator.next();
r.drawRangeMarker(g2, this, axis, marker, dataArea);
}
}
}
Draws the range markers (if any) for a renderer and layer. This method
is typically called from within the draw() method. |
public void drawRangeTickBands(Graphics2D g2,
Rectangle2D dataArea,
List ticks) {
Paint bandPaint = getRangeTickBandPaint();
if (bandPaint != null) {
boolean fillBand = false;
ValueAxis axis = getRangeAxis();
double previous = axis.getLowerBound();
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
ValueTick tick = (ValueTick) iterator.next();
double current = tick.getValue();
if (fillBand) {
getRenderer().fillRangeGridBand(g2, this, axis, dataArea,
previous, current);
}
previous = current;
fillBand = !fillBand;
}
double end = axis.getUpperBound();
if (fillBand) {
getRenderer().fillRangeGridBand(g2, this, axis, dataArea,
previous, end);
}
}
}
Draws the range tick bands, if any. |
protected void drawVerticalLine(Graphics2D g2,
Rectangle2D dataArea,
double value,
Stroke stroke,
Paint paint) {
ValueAxis axis = getDomainAxis();
if (getOrientation() == PlotOrientation.HORIZONTAL) {
axis = getRangeAxis();
}
if (axis.getRange().contains(value)) {
double xx = axis.valueToJava2D(value, dataArea,
RectangleEdge.BOTTOM);
Line2D line = new Line2D.Double(xx, dataArea.getMinY(), xx,
dataArea.getMaxY());
g2.setStroke(stroke);
g2.setPaint(paint);
g2.draw(line);
}
}
Utility method for drawing a vertical line on the data area of the plot. |
protected void drawZeroDomainBaseline(Graphics2D g2,
Rectangle2D area) {
if (isDomainZeroBaselineVisible()) {
XYItemRenderer r = getRenderer();
// FIXME: the renderer interface doesn't have the drawDomainLine()
// method, so we have to rely on the renderer being a subclass of
// AbstractXYItemRenderer (which is lame)
if (r instanceof AbstractXYItemRenderer) {
AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) r;
renderer.drawDomainLine(g2, this, getDomainAxis(), area, 0.0,
this.domainZeroBaselinePaint,
this.domainZeroBaselineStroke);
}
}
}
Draws a base line across the chart at value zero on the domain axis. |
protected void drawZeroRangeBaseline(Graphics2D g2,
Rectangle2D area) {
if (isRangeZeroBaselineVisible()) {
getRenderer().drawRangeLine(g2, this, getRangeAxis(), area, 0.0,
this.rangeZeroBaselinePaint, this.rangeZeroBaselineStroke);
}
}
Draws a base line across the chart at value zero on the range axis. |
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof XYPlot)) {
return false;
}
XYPlot that = (XYPlot) obj;
if (this.weight != that.weight) {
return false;
}
if (this.orientation != that.orientation) {
return false;
}
if (!this.domainAxes.equals(that.domainAxes)) {
return false;
}
if (!this.domainAxisLocations.equals(that.domainAxisLocations)) {
return false;
}
if (this.rangeCrosshairLockedOnData
!= that.rangeCrosshairLockedOnData) {
return false;
}
if (this.domainGridlinesVisible != that.domainGridlinesVisible) {
return false;
}
if (this.rangeGridlinesVisible != that.rangeGridlinesVisible) {
return false;
}
if (this.domainZeroBaselineVisible != that.domainZeroBaselineVisible) {
return false;
}
if (this.rangeZeroBaselineVisible != that.rangeZeroBaselineVisible) {
return false;
}
if (this.domainCrosshairVisible != that.domainCrosshairVisible) {
return false;
}
if (this.domainCrosshairValue != that.domainCrosshairValue) {
return false;
}
if (this.domainCrosshairLockedOnData
!= that.domainCrosshairLockedOnData) {
return false;
}
if (this.rangeCrosshairVisible != that.rangeCrosshairVisible) {
return false;
}
if (this.rangeCrosshairValue != that.rangeCrosshairValue) {
return false;
}
if (!ObjectUtilities.equal(this.axisOffset, that.axisOffset)) {
return false;
}
if (!ObjectUtilities.equal(this.renderers, that.renderers)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeAxes, that.rangeAxes)) {
return false;
}
if (!this.rangeAxisLocations.equals(that.rangeAxisLocations)) {
return false;
}
if (!ObjectUtilities.equal(this.datasetToDomainAxisMap,
that.datasetToDomainAxisMap)) {
return false;
}
if (!ObjectUtilities.equal(this.datasetToRangeAxisMap,
that.datasetToRangeAxisMap)) {
return false;
}
if (!ObjectUtilities.equal(this.domainGridlineStroke,
that.domainGridlineStroke)) {
return false;
}
if (!PaintUtilities.equal(this.domainGridlinePaint,
that.domainGridlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeGridlineStroke,
that.rangeGridlineStroke)) {
return false;
}
if (!PaintUtilities.equal(this.rangeGridlinePaint,
that.rangeGridlinePaint)) {
return false;
}
if (!PaintUtilities.equal(this.domainZeroBaselinePaint,
that.domainZeroBaselinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.domainZeroBaselineStroke,
that.domainZeroBaselineStroke)) {
return false;
}
if (!PaintUtilities.equal(this.rangeZeroBaselinePaint,
that.rangeZeroBaselinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeZeroBaselineStroke,
that.rangeZeroBaselineStroke)) {
return false;
}
if (!ObjectUtilities.equal(this.domainCrosshairStroke,
that.domainCrosshairStroke)) {
return false;
}
if (!PaintUtilities.equal(this.domainCrosshairPaint,
that.domainCrosshairPaint)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeCrosshairStroke,
that.rangeCrosshairStroke)) {
return false;
}
if (!PaintUtilities.equal(this.rangeCrosshairPaint,
that.rangeCrosshairPaint)) {
return false;
}
if (!ObjectUtilities.equal(this.foregroundDomainMarkers,
that.foregroundDomainMarkers)) {
return false;
}
if (!ObjectUtilities.equal(this.backgroundDomainMarkers,
that.backgroundDomainMarkers)) {
return false;
}
if (!ObjectUtilities.equal(this.foregroundRangeMarkers,
that.foregroundRangeMarkers)) {
return false;
}
if (!ObjectUtilities.equal(this.backgroundRangeMarkers,
that.backgroundRangeMarkers)) {
return false;
}
if (!ObjectUtilities.equal(this.foregroundDomainMarkers,
that.foregroundDomainMarkers)) {
return false;
}
if (!ObjectUtilities.equal(this.backgroundDomainMarkers,
that.backgroundDomainMarkers)) {
return false;
}
if (!ObjectUtilities.equal(this.foregroundRangeMarkers,
that.foregroundRangeMarkers)) {
return false;
}
if (!ObjectUtilities.equal(this.backgroundRangeMarkers,
that.backgroundRangeMarkers)) {
return false;
}
if (!ObjectUtilities.equal(this.annotations, that.annotations)) {
return false;
}
if (!PaintUtilities.equal(this.domainTickBandPaint,
that.domainTickBandPaint)) {
return false;
}
if (!PaintUtilities.equal(this.rangeTickBandPaint,
that.rangeTickBandPaint)) {
return false;
}
if (!this.quadrantOrigin.equals(that.quadrantOrigin)) {
return false;
}
for (int i = 0; i < 4; i++) {
if (!PaintUtilities.equal(this.quadrantPaint[i],
that.quadrantPaint[i])) {
return false;
}
}
return super.equals(obj);
}
Tests this plot for equality with another object. |
public List getAnnotations() {
return new ArrayList(this.annotations);
}
Returns the list of annotations. |
public RectangleInsets getAxisOffset() {
return this.axisOffset;
}
|
public Range getDataRange(ValueAxis axis) {
Range result = null;
List mappedDatasets = new ArrayList();
boolean isDomainAxis = true;
// is it a domain axis?
int domainIndex = getDomainAxisIndex(axis);
if (domainIndex >= 0) {
isDomainAxis = true;
mappedDatasets.addAll(getDatasetsMappedToDomainAxis(
new Integer(domainIndex)));
}
// or is it a range axis?
int rangeIndex = getRangeAxisIndex(axis);
if (rangeIndex >= 0) {
isDomainAxis = false;
mappedDatasets.addAll(getDatasetsMappedToRangeAxis(
new Integer(rangeIndex)));
}
// iterate through the datasets that map to the axis and get the union
// of the ranges.
Iterator iterator = mappedDatasets.iterator();
while (iterator.hasNext()) {
XYDataset d = (XYDataset) iterator.next();
if (d != null) {
XYItemRenderer r = getRendererForDataset(d);
if (isDomainAxis) {
if (r != null) {
result = Range.combine(result, r.findDomainBounds(d));
}
else {
result = Range.combine(result,
DatasetUtilities.findDomainBounds(d));
}
}
else {
if (r != null) {
result = Range.combine(result, r.findRangeBounds(d));
}
else {
result = Range.combine(result,
DatasetUtilities.findRangeBounds(d));
}
}
}
}
return result;
}
Returns the range for the specified axis. |
public XYDataset getDataset() {
return getDataset(0);
}
Returns the primary dataset for the plot. |
public XYDataset getDataset(int index) {
XYDataset result = null;
if (this.datasets.size() > index) {
result = (XYDataset) this.datasets.get(index);
}
return result;
}
|
public int getDatasetCount() {
return this.datasets.size();
}
Returns the number of datasets. |
public DatasetRenderingOrder getDatasetRenderingOrder() {
return this.datasetRenderingOrder;
}
Returns the dataset rendering order. |
public ValueAxis getDomainAxis() {
return getDomainAxis(0);
}
Returns the domain axis with index 0. If the domain axis for this plot
is null, then the method will return the parent plot's
domain axis (if there is a parent plot). |
public ValueAxis getDomainAxis(int index) {
ValueAxis result = null;
if (index < this.domainAxes.size()) {
result = (ValueAxis) this.domainAxes.get(index);
}
if (result == null) {
Plot parent = getParent();
if (parent instanceof XYPlot) {
XYPlot xy = (XYPlot) parent;
result = xy.getDomainAxis(index);
}
}
return result;
}
Returns the domain axis with the specified index, or null. |
public int getDomainAxisCount() {
return this.domainAxes.size();
}
Returns the number of domain axes. |
public RectangleEdge getDomainAxisEdge() {
return Plot.resolveDomainAxisLocation(getDomainAxisLocation(),
this.orientation);
}
Returns the edge for the primary domain axis (taking into account the
plot's orientation). |
public RectangleEdge getDomainAxisEdge(int index) {
AxisLocation location = getDomainAxisLocation(index);
RectangleEdge result = Plot.resolveDomainAxisLocation(location,
this.orientation);
if (result == null) {
result = RectangleEdge.opposite(getDomainAxisEdge());
}
return result;
}
Returns the edge for a domain axis. |
public ValueAxis getDomainAxisForDataset(int index) {
if (index < 0 || index >= getDatasetCount()) {
throw new IllegalArgumentException("Index " + index
+ " out of bounds.");
}
ValueAxis valueAxis = null;
Integer axisIndex = (Integer) this.datasetToDomainAxisMap.get(
new Integer(index));
if (axisIndex != null) {
valueAxis = getDomainAxis(axisIndex.intValue());
}
else {
valueAxis = getDomainAxis(0);
}
return valueAxis;
}
Returns the domain axis for a dataset. |
public int getDomainAxisIndex(ValueAxis axis) {
int result = this.domainAxes.indexOf(axis);
if (result < 0) {
// try the parent plot
Plot parent = getParent();
if (parent instanceof XYPlot) {
XYPlot p = (XYPlot) parent;
result = p.getDomainAxisIndex(axis);
}
}
return result;
}
Returns the index of the given domain axis. |
public AxisLocation getDomainAxisLocation() {
return (AxisLocation) this.domainAxisLocations.get(0);
}
Returns the location of the primary domain axis. |
public AxisLocation getDomainAxisLocation(int index) {
AxisLocation result = null;
if (index < this.domainAxisLocations.size()) {
result = (AxisLocation) this.domainAxisLocations.get(index);
}
if (result == null) {
result = AxisLocation.getOpposite(getDomainAxisLocation());
}
return result;
}
Returns the location for a domain axis. If this hasn't been set
explicitly, the method returns the location that is opposite to the
primary domain axis location. |
public Paint getDomainCrosshairPaint() {
return this.domainCrosshairPaint;
}
Returns the domain crosshair paint. |
public Stroke getDomainCrosshairStroke() {
return this.domainCrosshairStroke;
}
Returns the Stroke used to draw the crosshair (if visible). |
public double getDomainCrosshairValue() {
return this.domainCrosshairValue;
}
Returns the domain crosshair value. |
public Paint getDomainGridlinePaint() {
return this.domainGridlinePaint;
}
Returns the paint for the grid lines (if any) plotted against the domain
axis. |
public Stroke getDomainGridlineStroke() {
return this.domainGridlineStroke;
}
Returns the stroke for the grid-lines (if any) plotted against the
domain axis. |
public Collection getDomainMarkers(Layer layer) {
return getDomainMarkers(0, layer);
}
Returns the list of domain markers (read only) for the specified layer. |
public Collection getDomainMarkers(int index,
Layer layer) {
Collection result = null;
Integer key = new Integer(index);
if (layer == Layer.FOREGROUND) {
result = (Collection) this.foregroundDomainMarkers.get(key);
}
else if (layer == Layer.BACKGROUND) {
result = (Collection) this.backgroundDomainMarkers.get(key);
}
if (result != null) {
result = Collections.unmodifiableCollection(result);
}
return result;
}
Returns a collection of domain markers for a particular renderer and
layer. |
public Paint getDomainTickBandPaint() {
return this.domainTickBandPaint;
}
Returns the paint used for the domain tick bands. If this is
null, no tick bands will be drawn. |
public Paint getDomainZeroBaselinePaint() {
return this.domainZeroBaselinePaint;
}
Returns the paint for the zero baseline (if any) plotted against the
domain axis. |
public Stroke getDomainZeroBaselineStroke() {
return this.domainZeroBaselineStroke;
}
Returns the stroke used for the zero baseline against the domain axis. |
public AxisSpace getFixedDomainAxisSpace() {
return this.fixedDomainAxisSpace;
}
Returns the fixed domain axis space. |
public LegendItemCollection getFixedLegendItems() {
return this.fixedLegendItems;
}
Returns the fixed legend items, if any. |
public AxisSpace getFixedRangeAxisSpace() {
return this.fixedRangeAxisSpace;
}
Returns the fixed range axis space. |
public int getIndexOf(XYItemRenderer renderer) {
return this.renderers.indexOf(renderer);
}
Returns the index of the specified renderer, or -1 if |