xyplot.java
来自「JfreeChart 常用图表例子」· Java 代码 · 共 1,937 行 · 第 1/5 页
JAVA
1,937 行
*/ public Paint getDomainTickBandPaint() { return this.domainTickBandPaint; } /** * Sets the paint for the domain tick bands. * * @param paint the paint (<code>null</code> permitted). */ public void setDomainTickBandPaint(Paint paint) { this.domainTickBandPaint = paint; notifyListeners(new PlotChangeEvent(this)); } /** * Returns the paint used for the range tick bands. If this is * <code>null</code>, no tick bands will be drawn. * * @return The paint (possibly <code>null</code>). */ public Paint getRangeTickBandPaint() { return this.rangeTickBandPaint; } /** * Sets the paint for the range tick bands. * * @param paint the paint (<code>null</code> permitted). */ public void setRangeTickBandPaint(Paint paint) { this.rangeTickBandPaint = paint; notifyListeners(new PlotChangeEvent(this)); } /** * Returns the origin for the quadrants that can be displayed on the plot. * This defaults to (0, 0). * * @return The origin point (never <code>null</code>). */ public Point2D getQuadrantOrigin() { return this.quadrantOrigin; } /** * Sets the quadrant origin and sends a {@link PlotChangeEvent} to all * registered listeners. * * @param origin the origin (<code>null</code> not permitted). */ public void setQuadrantOrigin(Point2D origin) { if (origin == null) { throw new IllegalArgumentException("Null 'origin' argument."); } this.quadrantOrigin = origin; notifyListeners(new PlotChangeEvent(this)); } /** * Returns the paint used for the specified quadrant. * * @param index the quadrant index (0-3). * * @return The paint (possibly <code>null</code>). */ public Paint getQuadrantPaint(int index) { if (index < 0 || index > 3) { throw new IllegalArgumentException( "The index should be in the range 0 to 3." ); } return this.quadrantPaint[index]; } /** * Sets the paint used for the specified quadrant and sends a * {@link PlotChangeEvent} to all registered listeners. * * @param index the quadrant index (0-3). * @param paint the paint (<code>null</code> permitted). */ public void setQuadrantPaint(int index, Paint paint) { if (index < 0 || index > 3) { throw new IllegalArgumentException( "The index should be in the range 0 to 3." ); } this.quadrantPaint[index] = paint; notifyListeners(new PlotChangeEvent(this)); } /** * Adds a marker for the domain axis and sends a {@link PlotChangeEvent} * to all registered listeners. * <P> * 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. * * @param marker the marker (<code>null</code> not permitted). */ public void addDomainMarker(Marker marker) { // defer argument checking... addDomainMarker(marker, Layer.FOREGROUND); } /** * Adds a marker for the domain axis in the specified layer and sends a * {@link PlotChangeEvent} to all registered listeners. * <P> * 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. * * @param marker the marker (<code>null</code> not permitted). * @param layer the layer (foreground or background). */ public void addDomainMarker(Marker marker, Layer layer) { addDomainMarker(0, marker, layer); } /** * Clears all the (foreground and background) domain markers and sends a * {@link PlotChangeEvent} to all registered listeners. */ public void clearDomainMarkers() { if (this.foregroundDomainMarkers != null) { this.foregroundDomainMarkers.clear(); } if (this.backgroundDomainMarkers != null) { this.backgroundDomainMarkers.clear(); } notifyListeners(new PlotChangeEvent(this)); } /** * Clears the (foreground and background) domain markers for a particular * renderer. * * @param index the renderer index. */ public void clearDomainMarkers(int index) { Integer key = new Integer(index); if (this.backgroundDomainMarkers != null) { Collection markers = (Collection) this.backgroundDomainMarkers.get(key); if (markers != null) { markers.clear(); } } if (this.foregroundRangeMarkers != null) { Collection markers = (Collection) this.foregroundDomainMarkers.get(key); if (markers != null) { markers.clear(); } } notifyListeners(new PlotChangeEvent(this)); } /** * Adds a marker for a renderer and sends a {@link PlotChangeEvent} to * all registered listeners. * <P> * 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. * * @param index the renderer index. * @param marker the marker. * @param layer the layer (foreground or background). */ public void addDomainMarker(int index, Marker marker, Layer layer) { 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); } notifyListeners(new PlotChangeEvent(this)); } /** * Adds a marker for the range axis and sends a {@link PlotChangeEvent} to * all registered listeners. * <P> * 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. * * @param marker the marker (<code>null</code> not permitted). */ public void addRangeMarker(Marker marker) { addRangeMarker(marker, Layer.FOREGROUND); } /** * Adds a marker for the range axis in the specified layer and sends a * {@link PlotChangeEvent} to all registered listeners. * <P> * 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. * * @param marker the marker (<code>null</code> not permitted). * @param layer the layer (foreground or background). */ public void addRangeMarker(Marker marker, Layer layer) { addRangeMarker(0, marker, layer); } /** * Clears all the range markers and sends a {@link PlotChangeEvent} to all * registered listeners. */ public void clearRangeMarkers() { if (this.foregroundRangeMarkers != null) { this.foregroundRangeMarkers.clear(); } if (this.backgroundRangeMarkers != null) { this.backgroundRangeMarkers.clear(); } notifyListeners(new PlotChangeEvent(this)); } /** * Adds a marker for a renderer and sends a {@link PlotChangeEvent} to * all registered listeners. * <P> * 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. * * @param index the renderer index. * @param marker the marker. * @param layer the layer (foreground or background). */ public void addRangeMarker(int index, Marker marker, Layer layer) { 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); } notifyListeners(new PlotChangeEvent(this)); } /** * Clears the (foreground and background) range markers for a particular * renderer. * * @param index the renderer index. */ public void clearRangeMarkers(int index) { Integer key = new Integer(index); if (this.backgroundRangeMarkers != null) { Collection markers = (Collection) this.backgroundRangeMarkers.get(key); if (markers != null) { markers.clear(); } } if (this.foregroundRangeMarkers != null) { Collection markers = (Collection) this.foregroundRangeMarkers.get(key); if (markers != null) { markers.clear(); } } notifyListeners(new PlotChangeEvent(this)); } /** * Adds an annotation to the plot and sends a {@link PlotChangeEvent} to all * registered listeners. * * @param annotation the annotation (<code>null</code> not permitted). */ public void addAnnotation(XYAnnotation annotation) { if (annotation == null) { throw new IllegalArgumentException("Null 'annotation' argument."); } this.annotations.add(annotation); notifyListeners(new PlotChangeEvent(this)); } /** * Removes an annotation from the plot and sends a {@link PlotChangeEvent} * to all registered listeners. * * @param annotation the annotation (<code>null</code> not permitted). * * @return A boolean (indicates whether or not the annotation was removed). */ public boolean removeAnnotation(XYAnnotation annotation) { if (annotation == null) { throw new IllegalArgumentException("Null 'annotation' argument."); } boolean removed = this.annotations.remove(annotation); if (removed) { notifyListeners(new PlotChangeEvent(this)); } return removed; } /** * Clears all the annotations and sends a {@link PlotChangeEvent} to all * registered listeners. */ public void clearAnnotations() { this.annotations.clear(); notifyListeners(new PlotChangeEvent(this)); } /** * Calculates the space required for all the axes in the plot. * * @param g2 the graphics device. * @param plotArea the plot area. * * @return The required space. */ protected AxisSpace calculateAxisSpace(Graphics2D g2, Rectangle2D plotArea) { AxisSpace space = new AxisSpace(); space = calculateDomainAxisSpace(g2, plotArea, space); space = calculateRangeAxisSpace(g2, plotArea, space); return space; } /** * Calculates the space required for the domain axis/axes. * * @param g2 the graphics device. * @param plotArea the plot area. * @param space a carrier for the result (<code>null</code> permitted). * * @return The required space. */ 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) {
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?