categoryplot.java
来自「JfreeChart 常用图表例子」· Java 代码 · 共 1,964 行 · 第 1/5 页
JAVA
1,964 行
"The renderer has changed and I don't know what to do!" ); } } else { PlotChangeEvent e = new PlotChangeEvent(this); notifyListeners(e); } } /** * Adds a marker for display (in the foreground) against the domain axis and * sends a {@link PlotChangeEvent} to all registered listeners. Typically a * marker will be drawn by the renderer as a line perpendicular to the * domain axis, however this is entirely up to the renderer. * * @param marker the marker (<code>null</code> not permitted). */ public void addDomainMarker(CategoryMarker marker) { addDomainMarker(marker, Layer.FOREGROUND); } /** * Adds a marker for display against the domain axis and sends a * {@link PlotChangeEvent} to all registered listeners. Typically a marker * will be drawn by the renderer as a line perpendicular to the domain 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) (<code>null</code> * not permitted). */ public void addDomainMarker(CategoryMarker marker, Layer layer) { addDomainMarker(0, marker, layer); } /** * Adds a marker for display by a particular renderer. * <P> * Typically a marker will be drawn by the renderer as a line perpendicular * to a domain axis, however this is entirely up to the renderer. * * @param index the renderer index. * @param marker the marker. * @param layer the layer. */ public void addDomainMarker(int index, CategoryMarker 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)); } /** * Clears all the domain markers for the plot and sends a * {@link PlotChangeEvent} to all registered listeners. */ public void clearDomainMarkers() { if (this.backgroundDomainMarkers != null) { this.backgroundDomainMarkers.clear(); } if (this.foregroundDomainMarkers != null) { this.foregroundDomainMarkers.clear(); } notifyListeners(new PlotChangeEvent(this)); } /** * Returns the list of domain markers (read only) for the specified layer. * * @param layer the layer (foreground or background). * * @return The list of domain markers. */ public Collection getDomainMarkers(Layer layer) { return getDomainMarkers(0, layer); } /** * Returns a collection of domain markers for a particular renderer and * layer. * * @param index the renderer index. * @param layer the layer. * * @return A collection of markers (possibly <code>null</code>). */ 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; } /** * Clears all the domain markers for the specified 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.foregroundDomainMarkers != null) { Collection markers = (Collection) this.foregroundDomainMarkers.get(key); if (markers != null) { markers.clear(); } } notifyListeners(new PlotChangeEvent(this)); } /** * Adds a marker for display (in the foreground) against the range axis and * sends a {@link 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. * * @param marker the marker (<code>null</code> not permitted). */ public void addRangeMarker(Marker marker) { addRangeMarker(marker, Layer.FOREGROUND); } /** * Adds a marker for display against the range axis and sends a * {@link 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. * * @param marker the marker (<code>null</code> not permitted). * @param layer the layer (foreground or background) (<code>null</code> * not permitted). */ public void addRangeMarker(Marker marker, Layer layer) { addRangeMarker(0, marker, layer); } /** * Adds a marker for display by a particular renderer. * <P> * Typically a marker will be drawn by the renderer as a line perpendicular * to a range axis, however this is entirely up to the renderer. * * @param index the renderer index. * @param marker the marker. * @param layer the layer. */ 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 all the range markers for the plot and sends a * {@link PlotChangeEvent} to all registered listeners. */ public void clearRangeMarkers() { if (this.backgroundRangeMarkers != null) { this.backgroundRangeMarkers.clear(); } if (this.foregroundRangeMarkers != null) { this.foregroundRangeMarkers.clear(); } notifyListeners(new PlotChangeEvent(this)); } /** * Returns the list of range markers (read only) for the specified layer. * * @param layer the layer (foreground or background). * * @return The list of range markers. */ public Collection getRangeMarkers(Layer layer) { return getRangeMarkers(0, layer); } /** * Returns a collection of range markers for a particular renderer and * layer. * * @param index the renderer index. * @param layer the layer. * * @return A collection of markers (possibly <code>null</code>). */ public Collection getRangeMarkers(int index, Layer layer) { Collection result = null; Integer key = new Integer(index); if (layer == Layer.FOREGROUND) { result = (Collection) this.foregroundRangeMarkers.get(key); } else if (layer == Layer.BACKGROUND) { result = (Collection) this.backgroundRangeMarkers.get(key); } if (result != null) { result = Collections.unmodifiableCollection(result); } return result; } /** * Clears all the range markers for the specified 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)); } /** * Returns a flag indicating whether or not the range crosshair is visible. * * @return The flag. */ public boolean isRangeCrosshairVisible() { return this.rangeCrosshairVisible; } /** * Sets the flag indicating whether or not the range crosshair is visible. * * @param flag the new value of the flag. */ public void setRangeCrosshairVisible(boolean flag) { if (this.rangeCrosshairVisible != flag) { this.rangeCrosshairVisible = flag; notifyListeners(new PlotChangeEvent(this)); } } /** * Returns a flag indicating whether or not the crosshair should "lock-on" * to actual data values. * * @return The flag. */ public boolean isRangeCrosshairLockedOnData() { return this.rangeCrosshairLockedOnData; } /** * Sets the flag indicating whether or not the range crosshair should * "lock-on" to actual data values. * * @param flag the flag. */ public void setRangeCrosshairLockedOnData(boolean flag) { if (this.rangeCrosshairLockedOnData != flag) { this.rangeCrosshairLockedOnData = flag; notifyListeners(new PlotChangeEvent(this)); } } /** * Returns the range crosshair value. * * @return The value. */ public double getRangeCrosshairValue() { return this.rangeCrosshairValue; } /** * Sets the domain crosshair value. * <P> * Registered listeners are notified that the plot has been modified, but * only if the crosshair is visible. * * @param value the new value. */ public void setRangeCrosshairValue(double value) { setRangeCrosshairValue(value, true); } /** * Sets the range crosshair value. * <P> * Registered listeners are notified that the axis has been modified, but * only if the crosshair is visible. * * @param value the new value. * @param notify a flag that controls whether or not listeners are * notified. */ public void setRangeCrosshairValue(double value, boolean notify) { this.rangeCrosshairValue = value; if (isRangeCrosshairVisible() && notify) { notifyListeners(new PlotChangeEvent(this)); } } /** * Returns the pen-style (<code>Stroke</code>) used to draw the crosshair * (if visible). * * @return The crosshair stroke. */ public Stroke getRangeCrosshairStroke() { return this.rangeCrosshairStroke; } /** * Sets the pen-style (<code>Stroke</code>) used to draw the crosshairs * (if visible). A {@link PlotChangeEvent} is sent to all registered * listeners. * * @param stroke the new crosshair stroke. */ public void setRangeCrosshairStroke(Stroke stroke) { this.rangeCrosshairStroke = stroke; notifyListeners(new PlotChangeEvent(this)); } /** * Returns
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?