Java源码示例:org.jfree.chart.annotations.XYAnnotation
示例1
/**
* Adds an annotation to the specified layer and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param annotation the annotation (<code>null</code> not permitted).
* @param layer the layer (<code>null</code> not permitted).
*/
@Override
public void addAnnotation(XYAnnotation annotation, Layer layer) {
ParamChecks.nullNotPermitted(annotation, "annotation");
if (layer.equals(Layer.FOREGROUND)) {
this.foregroundAnnotations.add(annotation);
annotation.addChangeListener(this);
fireChangeEvent();
}
else if (layer.equals(Layer.BACKGROUND)) {
this.backgroundAnnotations.add(annotation);
annotation.addChangeListener(this);
fireChangeEvent();
}
else {
// should never get here
throw new RuntimeException("Unknown layer.");
}
}
示例2
/**
* 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.
*/
@Override
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
ValueAxis 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()) {
XYAnnotation annotation = (XYAnnotation) iterator.next();
int index = this.plot.getIndexOf(this);
annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
index, info);
}
}
示例3
/**
* 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.
*/
@Override
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
ValueAxis 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()) {
XYAnnotation annotation = (XYAnnotation) iterator.next();
int index = this.plot.getIndexOf(this);
annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
index, info);
}
}
示例4
/**
* 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.
*/
@Override
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
ValueAxis 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()) {
XYAnnotation annotation = (XYAnnotation) iterator.next();
int index = this.plot.getIndexOf(this);
annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
index, info);
}
}
示例5
/**
* 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.
*/
@Override
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
ValueAxis 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()) {
XYAnnotation annotation = (XYAnnotation) iterator.next();
int index = this.plot.getIndexOf(this);
annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
index, info);
}
}
示例6
void updateAnnotation(RasterDataNode raster) {
removeAnnotation();
final AbstractTimeSeries timeSeries = getTimeSeries();
TimeCoding timeCoding = timeSeries.getRasterTimeMap().get(raster);
if (timeCoding != null) {
final ProductData.UTC startTime = timeCoding.getStartTime();
final Millisecond timePeriod = new Millisecond(startTime.getAsDate(),
ProductData.UTC.UTC_TIME_ZONE,
Locale.getDefault());
double millisecond = timePeriod.getFirstMillisecond();
Range valueRange = null;
for (int i = 0; i < timeSeriesPlot.getRangeAxisCount(); i++) {
valueRange = Range.combine(valueRange, timeSeriesPlot.getRangeAxis(i).getRange());
}
if (valueRange != null) {
XYAnnotation annotation = new XYLineAnnotation(millisecond, valueRange.getLowerBound(), millisecond,
valueRange.getUpperBound());
timeSeriesPlot.addAnnotation(annotation, true);
}
}
}
示例7
/**
* Adds an annotation to the specified layer and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param annotation the annotation (<code>null</code> not permitted).
* @param layer the layer (<code>null</code> not permitted).
*/
public void addAnnotation(XYAnnotation annotation, Layer layer) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
if (layer.equals(Layer.FOREGROUND)) {
this.foregroundAnnotations.add(annotation);
annotation.addChangeListener(this);
fireChangeEvent();
}
else if (layer.equals(Layer.BACKGROUND)) {
this.backgroundAnnotations.add(annotation);
annotation.addChangeListener(this);
fireChangeEvent();
}
else {
// should never get here
throw new RuntimeException("Unknown layer.");
}
}
示例8
/**
* Adds an annotation to the specified layer and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param annotation the annotation (<code>null</code> not permitted).
* @param layer the layer (<code>null</code> not permitted).
*/
@Override
public void addAnnotation(XYAnnotation annotation, Layer layer) {
ParamChecks.nullNotPermitted(annotation, "annotation");
if (layer.equals(Layer.FOREGROUND)) {
this.foregroundAnnotations.add(annotation);
annotation.addChangeListener(this);
fireChangeEvent();
}
else if (layer.equals(Layer.BACKGROUND)) {
this.backgroundAnnotations.add(annotation);
annotation.addChangeListener(this);
fireChangeEvent();
}
else {
// should never get here
throw new RuntimeException("Unknown layer.");
}
}
示例9
@Override
public void addAnnotations(List<Annotation> annotations) {
if (getChart() != null) {
XYPlot plot = getChart().getXYPlot();
plot.clearAnnotations();
for (Annotation a : annotations) {
if (a instanceof XYAnnotation) {
XYAnnotation annotation = (XYAnnotation) a;
plot.addAnnotation(annotation);
firePropertyChange("annotation", null, annotation);
}
}
}
}
示例10
/**
* Adds an annotation to the specified layer and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param annotation the annotation (<code>null</code> not permitted).
* @param layer the layer (<code>null</code> not permitted).
*/
@Override
public void addAnnotation(XYAnnotation annotation, Layer layer) {
ParamChecks.nullNotPermitted(annotation, "annotation");
if (layer.equals(Layer.FOREGROUND)) {
this.foregroundAnnotations.add(annotation);
annotation.addChangeListener(this);
fireChangeEvent();
}
else if (layer.equals(Layer.BACKGROUND)) {
this.backgroundAnnotations.add(annotation);
annotation.addChangeListener(this);
fireChangeEvent();
}
else {
// should never get here
throw new RuntimeException("Unknown layer.");
}
}
示例11
/**
* Draws the annotations for the plot.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param info the chart rendering info.
*/
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);
}
}
示例12
/**
* Adds an annotation to the plot.
*
* @param annotation the annotation.
*/
public void addAnnotation(XYAnnotation annotation) {
if (this.annotations == null) {
this.annotations = new java.util.ArrayList();
}
this.annotations.add(annotation);
fireChangeEvent();
}
示例13
/**
* Applies the settings of this theme to the specified annotation.
*
* @param annotation the annotation.
*/
protected void applyToXYAnnotation(XYAnnotation annotation) {
ParamChecks.nullNotPermitted(annotation, "annotation");
if (annotation instanceof XYTextAnnotation) {
XYTextAnnotation xyta = (XYTextAnnotation) annotation;
xyta.setFont(this.smallFont);
xyta.setPaint(this.itemLabelPaint);
}
}
示例14
/**
* Clears all the annotations and sends a {@link PlotChangeEvent} to all
* registered listeners.
*
* @see #addAnnotation(XYAnnotation)
*/
public void clearAnnotations() {
for (XYAnnotation annotation : this.annotations) {
annotation.removeChangeListener(this);
}
this.annotations.clear();
fireChangeEvent();
}
示例15
/**
* Applies the settings of this theme to the specified annotation.
*
* @param annotation the annotation.
*/
protected void applyToXYAnnotation(XYAnnotation annotation) {
ParamChecks.nullNotPermitted(annotation, "annotation");
if (annotation instanceof XYTextAnnotation) {
XYTextAnnotation xyta = (XYTextAnnotation) annotation;
xyta.setFont(this.smallFont);
xyta.setPaint(this.itemLabelPaint);
}
}
示例16
/**
* 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(XYAnnotation annotation, boolean notify) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
this.annotations.add(annotation);
if (notify) {
fireChangeEvent();
}
}
示例17
/**
* Clears all the annotations and sends a {@link PlotChangeEvent} to all
* registered listeners.
*
* @see #addAnnotation(XYAnnotation)
*/
public void clearAnnotations() {
for (XYAnnotation annotation : this.annotations) {
annotation.removeChangeListener(this);
}
this.annotations.clear();
fireChangeEvent();
}
示例18
/**
* 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(XYAnnotation annotation, boolean notify) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
this.annotations.add(annotation);
if (notify) {
fireChangeEvent();
}
}
示例19
/**
* 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(XYAnnotation annotation, boolean notify) {
if (annotation == null) {
throw new IllegalArgumentException("Null 'annotation' argument.");
}
this.annotations.add(annotation);
if (notify) {
fireChangeEvent();
}
}
示例20
/**
* Draws the annotations for the plot.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param info the chart rendering info.
*/
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);
}
}
示例21
/**
* Applies the settings of this theme to the specified annotation.
*
* @param annotation the annotation.
*/
protected void applyToXYAnnotation(XYAnnotation annotation) {
ParamChecks.nullNotPermitted(annotation, "annotation");
if (annotation instanceof XYTextAnnotation) {
XYTextAnnotation xyta = (XYTextAnnotation) annotation;
xyta.setFont(this.smallFont);
xyta.setPaint(this.itemLabelPaint);
}
}
示例22
/**
* Draws the annotations for the plot.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param info the chart rendering info.
*/
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);
}
}
示例23
/**
* Applies the settings of this theme to the specified annotation.
*
* @param annotation the annotation.
*/
protected void applyToXYAnnotation(XYAnnotation annotation) {
ParamChecks.nullNotPermitted(annotation, "annotation");
if (annotation instanceof XYTextAnnotation) {
XYTextAnnotation xyta = (XYTextAnnotation) annotation;
xyta.setFont(this.smallFont);
xyta.setPaint(this.itemLabelPaint);
}
}
示例24
/**
* Applies the settings of this theme to the specified annotation.
*
* @param annotation the annotation.
*/
protected void applyToXYAnnotation(XYAnnotation annotation) {
ParamChecks.nullNotPermitted(annotation, "annotation");
if (annotation instanceof XYTextAnnotation) {
XYTextAnnotation xyta = (XYTextAnnotation) annotation;
xyta.setFont(this.smallFont);
xyta.setPaint(this.itemLabelPaint);
}
}
示例25
/**
* Adds an annotation to the plot.
*
* @param annotation the annotation.
*/
public void addAnnotation(XYAnnotation annotation) {
if (this.annotations == null) {
this.annotations = new java.util.ArrayList();
}
this.annotations.add(annotation);
fireChangeEvent();
}
示例26
/**
* Clears all the annotations and sends a {@link PlotChangeEvent} to all
* registered listeners.
*
* @see #addAnnotation(XYAnnotation)
*/
public void clearAnnotations() {
for (XYAnnotation annotation : this.annotations) {
annotation.removeChangeListener(this);
}
this.annotations.clear();
fireChangeEvent();
}
示例27
/**
* Draws the annotations for the plot.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param info the chart rendering info.
*/
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);
}
}
示例28
/**
* Adds an annotation to the plot.
*
* @param annotation the annotation.
*/
public void addAnnotation(XYAnnotation annotation) {
if (this.annotations == null) {
this.annotations = new java.util.ArrayList();
}
this.annotations.add(annotation);
notifyListeners(new PlotChangeEvent(this));
}
示例29
/**
* Draws the annotations for the plot.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param info the chart rendering info.
*/
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);
}
}
示例30
/**
* Draws the annotations for the plot.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param info the chart rendering info.
*/
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);
}
}