本文整理汇总了Java中org.jfree.chart.annotations.CategoryAnnotation类的典型用法代码示例。如果您正苦于以下问题:Java CategoryAnnotation类的具体用法?Java CategoryAnnotation怎么用?Java CategoryAnnotation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CategoryAnnotation类属于org.jfree.chart.annotations包,在下文中一共展示了CategoryAnnotation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAnnotation
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Adds an annotation to the specified layer.
*
* @param annotation the annotation (<code>null</code> not permitted).
* @param layer the layer (<code>null</code> not permitted).
*
* @since 1.2.0
*/
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
if (layer.equals(Layer.FOREGROUND)) {
this.foregroundAnnotations.add(annotation);
notifyListeners(new RendererChangeEvent(this));
}
else if (layer.equals(Layer.BACKGROUND)) {
this.backgroundAnnotations.add(annotation);
notifyListeners(new RendererChangeEvent(this));
}
else {
// should never get here
throw new RuntimeException("Unknown layer.");
}
}
示例2: drawAnnotations
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Draws all the annotations for the specified layer.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param layer the layer.
* @param info the plot rendering info.
*
* @since 1.2.0
*/
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
PlotRenderingInfo info) {
Iterator iterator = null;
if (layer.equals(Layer.FOREGROUND)) {
iterator = this.foregroundAnnotations.iterator();
}
else if (layer.equals(Layer.BACKGROUND)) {
iterator = this.backgroundAnnotations.iterator();
}
else {
// should not get here
throw new RuntimeException("Unknown layer.");
}
while (iterator.hasNext()) {
CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
0, info);
}
}
示例3: addAnnotation
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Adds an annotation to the plot.
*
* @param annotation the annotation.
*/
public void addAnnotation(CategoryAnnotation annotation) {
if (this.annotations == null) {
this.annotations = new java.util.ArrayList();
}
this.annotations.add(annotation);
notifyListeners(new PlotChangeEvent(this));
}
示例4: drawAnnotations
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Draws the annotations...
*
* @param g2 the graphics device.
* @param dataArea the data area.
*/
protected void drawAnnotations(Graphics2D g2, Rectangle2D dataArea) {
if (getAnnotations() != null) {
Iterator iterator = getAnnotations().iterator();
while (iterator.hasNext()) {
CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
annotation.draw(g2, this, dataArea, getDomainAxis(), getRangeAxis());
}
}
}
示例5: removeAnnotation
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* 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).
*
* @see #addAnnotation(CategoryAnnotation)
*/
public boolean removeAnnotation(CategoryAnnotation annotation) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
boolean removed = this.annotations.remove(annotation);
if (removed) {
notifyListeners(new PlotChangeEvent(this));
}
return removed;
}
示例6: drawAnnotations
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Draws the annotations...
*
* @param g2 the graphics device.
* @param dataArea the data area.
*/
protected void drawAnnotations(Graphics2D g2, Rectangle2D dataArea) {
if (getAnnotations() != null) {
Iterator iterator = getAnnotations().iterator();
while (iterator.hasNext()) {
CategoryAnnotation annotation
= (CategoryAnnotation) iterator.next();
annotation.draw(g2, this, dataArea, getDomainAxis(),
getRangeAxis());
}
}
}
示例7: clearAnnotations
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Clears all the annotations and sends a {@link PlotChangeEvent} to all
* registered listeners.
*/
public void clearAnnotations() {
for (int i = 0; i < this.annotations.size(); i++) {
CategoryAnnotation annotation
= (CategoryAnnotation) this.annotations.get(i);
annotation.removeChangeListener(this);
}
this.annotations.clear();
fireChangeEvent();
}
示例8: drawAnnotations
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Draws the annotations.
*
* @param g2 the graphics device.
* @param dataArea the data area.
*/
protected void drawAnnotations(Graphics2D g2, Rectangle2D dataArea) {
if (getAnnotations() != null) {
Iterator iterator = getAnnotations().iterator();
while (iterator.hasNext()) {
CategoryAnnotation annotation
= (CategoryAnnotation) iterator.next();
annotation.draw(g2, this, dataArea, getDomainAxis(),
getRangeAxis());
}
}
}
示例9: addAnnotation
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Adds an annotation to the plot and, if requested, sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param annotation the annotation (<code>null</code> not permitted).
* @param notify notify listeners?
*
* @since 1.0.10
*/
public void addAnnotation(CategoryAnnotation annotation, boolean notify) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
this.annotations.add(annotation);
if (notify) {
fireChangeEvent();
}
}
示例10: removeAnnotation
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Removes an annotation from the plot and, if requested, sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param annotation the annotation (<code>null</code> not permitted).
* @param notify notify listeners?
*
* @return A boolean (indicates whether or not the annotation was removed).
*
* @since 1.0.10
*/
public boolean removeAnnotation(CategoryAnnotation annotation,
boolean notify) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
boolean removed = this.annotations.remove(annotation);
if (removed && notify) {
fireChangeEvent();
}
return removed;
}
示例11: addAnnotation
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Adds an annotation to the plot and, if requested, sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param annotation the annotation (<code>null</code> not permitted).
* @param notify notify listeners?
*
* @since 1.0.10
*/
public void addAnnotation(CategoryAnnotation annotation, boolean notify) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
this.annotations.add(annotation);
annotation.addChangeListener(this);
if (notify) {
fireChangeEvent();
}
}
示例12: removeAnnotation
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Removes an annotation from the plot and, if requested, sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param annotation the annotation (<code>null</code> not permitted).
* @param notify notify listeners?
*
* @return A boolean (indicates whether or not the annotation was removed).
*
* @since 1.0.10
*/
public boolean removeAnnotation(CategoryAnnotation annotation,
boolean notify) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
boolean removed = this.annotations.remove(annotation);
annotation.removeChangeListener(this);
if (removed && notify) {
fireChangeEvent();
}
return removed;
}
示例13: clearAnnotations
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Clears all the annotations and sends a {@link PlotChangeEvent} to all
* registered listeners.
*/
public void clearAnnotations() {
for(int i = 0; i < this.annotations.size(); i++) {
CategoryAnnotation annotation
= (CategoryAnnotation) this.annotations.get(i);
annotation.removeChangeListener(this);
}
this.annotations.clear();
fireChangeEvent();
}
示例14: drawAnnotations
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* Draws the annotations.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param info the plot rendering info (<code>null</code> permitted).
*/
protected void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
PlotRenderingInfo info) {
Iterator iterator = getAnnotations().iterator();
while (iterator.hasNext()) {
CategoryAnnotation annotation
= (CategoryAnnotation) iterator.next();
annotation.draw(g2, this, dataArea, getDomainAxis(),
getRangeAxis(), 0, info);
}
}
示例15: addAnnotation
import org.jfree.chart.annotations.CategoryAnnotation; //导入依赖的package包/类
/**
* 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(CategoryAnnotation annotation) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
this.annotations.add(annotation);
notifyListeners(new PlotChangeEvent(this));
}