## org.das2.graph.DasAnnotation

This makes a DasCanvasComponent for GrannyTextRenderer, and optionally adds an arrow to point at things. TODO: See https://autoplot.org/developer.annotations

## DasAnnotation( String string )

Create the annotation

## PROP_TEXT

## PROP_URL

## PROP_PADDING

the amount of space between the text and the border, measured in ems, pts, pxs, or percents.

## PROP_SCALE

## PROP_FONT_SIZE

the font size in pixels.

## PROP_BORDERTYPE

## PROP_ANCHORPOSITION

## PROP_XRANGE

## PROP_YRANGE

## PROP_POINTATX

## PROP_POINTATY

## PROP_REFERENCEX

## PROP_REFERENCEY

## PROP_ROTATE

## PROP_GLOW

## PROP_SYMBOL

## PROP_POINTATOFFSET

## PROP_SHOWARROW

## PROP_ANCHORBORDERTYPE

## PROP_ANCHORBACKGROUND

## PROP_ANCHORTYPE

## PROP_SPLITANCHORTYPE

## PROP_VERTICALANCHORTYPE

## PROP_ARROWSTYLE

## PROP_LINETHICKNESS

## PROP_OVERRIDECOLORS

## PROP_TEXTCOLOR

## PROP_ANCHOROFFSET

## acceptContext

acceptContext( int x, int y ) → boolean

### Parameters

x - an int
y - an int

### Returns:

boolean
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## addPainter

addPainter( String id, org.das2.util.GrannyTextRenderer.Painter p ) → void

add a painter for the grannyTextRenderer. This is done by associating a Painter code with an id, and the id is used within the annotation string.

### Parameters

id - id for the painter, where the id is found in the granny text string
p - the painter code which draws on a graphics context.

### Returns:

void (returns nothing)

### See Also:

org.das2.util.GrannyTextRenderer#addPainter(java.lang.String, org.das2.util.GrannyTextRenderer.Painter)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## clearPainters

clearPainters( ) → void

remove all the painters

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## contains

contains( int x, int y ) → boolean

This item should only accept mouse events on the bubble

### Parameters

x - an int
y - an int

### Returns:

a boolean
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getActiveRegion

getActiveRegion( ) → java.awt.Shape

### Returns:

java.awt.Shape
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getAnchorBackground

getAnchorBackground( ) → java.awt.Color

### Returns:

java.awt.Color
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getAnchorBorderType

getAnchorBorderType( ) → org.das2.graph.BorderType

### Returns:

org.das2.graph.BorderType
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getAnchorOffset

getAnchorOffset( ) → String

### Returns:

java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getAnchorPosition

getAnchorPosition( ) → org.das2.graph.AnchorPosition

get the location within the box where the annotation will be drawn.

### Returns:

anchorPosition
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getAnchorType

getAnchorType( ) → org.das2.graph.AnchorType

### Returns:

org.das2.graph.AnchorType
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getArrowStyle

getArrowStyle( ) → org.das2.graph.Arrow.HeadStyle

get the arrow style

### Returns:

the arrow style
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getBorderType

getBorderType( ) → org.das2.graph.BorderType

the border type

### Returns:

the border type
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getFontSize

getFontSize( ) → float

the font size in points. If zero, then use the canvas size.

### Returns:

the font size in points.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getLineThickness

getLineThickness( ) → String

### Returns:

java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getPadding

getPadding( ) → String

### Returns:

java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getPointAt

getPointAt( ) → org.das2.graph.DasAnnotation.PointDescriptor

return the thing we are pointing at.

### Returns:

the thing we are pointing at.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getPointAtOffset

getPointAtOffset( ) → String

### Returns:

java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getPointAtX

getPointAtX( ) → Datum

### Returns:

org.das2.datum.Datum
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getPointAtY

getPointAtY( ) → Datum

### Returns:

org.das2.datum.Datum
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getReferenceX

getReferenceX( ) → String

### Returns:

java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getReferenceY

getReferenceY( ) → String

### Returns:

java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getRotate

getRotate( ) → int

### Returns:

int
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getRotatedBoundingBox

getRotatedBoundingBox( java.awt.Rectangle rect, double angle ) → java.awt.Rectangle

Returns the axis-aligned bounding box of a Rectangle rotated about its center. (Thanks, ChatGPT!)

### Parameters

rect - The original rectangle (axis-aligned).
angle - Rotation angle in radians (counter-clockwise).

### Returns:

A new Rectangle representing the bounding box of the rotated rectangle.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getScale

getScale( ) → double

### Returns:

double
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getSymbol

getSymbol( ) → org.das2.graph.PlotSymbol

### Returns:

org.das2.graph.PlotSymbol
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getText

getText( ) → String

get the text, which can be Granny Text.

### Returns:

the text.

### See Also:

GrannyTextRenderer
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getTextColor

getTextColor( ) → java.awt.Color

### Returns:

java.awt.Color
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getUrl

getUrl( ) → String

### Returns:

java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getVerticalAnchorType

getVerticalAnchorType( ) → org.das2.graph.AnchorType

### Returns:

org.das2.graph.AnchorType
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getXrange

getXrange( ) → DatumRange

### Returns:

org.das2.datum.DatumRange
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getYrange

getYrange( ) → DatumRange

### Returns:

org.das2.datum.DatumRange
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## isGlow

isGlow( ) → boolean

### Returns:

boolean
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## isOverrideColors

isOverrideColors( ) → boolean

### Returns:

boolean
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## isShowArrow

isShowArrow( ) → boolean

### Returns:

boolean
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## isSplitAnchorType

isSplitAnchorType( ) → boolean

### Returns:

boolean
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## paintComponent

paintComponent( java.awt.Graphics g1 ) → void

### Parameters

g1 - a Graphics

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## removePainter

removePainter( String id ) → void

remove the painter with the given id.

### Parameters

id - id for the painter, where the id is found in the granny text string

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## resize

resize( ) → void

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setAnchorBackground

setAnchorBackground( java.awt.Color anchorBackground ) → void

### Parameters

anchorBackground - a Color

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setAnchorBorderType

setAnchorBorderType( org.das2.graph.BorderType anchorBorderType ) → void

### Parameters

anchorBorderType - a BorderType

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setAnchorOffset

setAnchorOffset( String anchorOffset ) → void

the offset in x and y for the text bubble from the anchor. For example, "4em,4em" will place a OutsideNE label 4ems up and 4ems over from the default.

### Parameters

anchorOffset - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setAnchorPosition

setAnchorPosition( org.das2.graph.AnchorPosition anchorPosition ) → void

set the location within the box where the annotation will be drawn.

### Parameters

anchorPosition - an AnchorPosition

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setAnchorType

setAnchorType( org.das2.graph.AnchorType anchorType ) → void

### Parameters

anchorType - an AnchorType

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setArrowStyle

setArrowStyle( org.das2.graph.Arrow.HeadStyle newarrowStyle ) → void

set the arrow style to BIG,SMALL,DRAFTING.

### Parameters

newarrowStyle - the arrow style

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setBorderType

setBorderType( org.das2.graph.BorderType newborderType ) → void

set the border type to NONE, rounded rectangle, etc.

### Parameters

newborderType - the border type

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setFontSize

setFontSize( float fontSize ) → void

override the canvas font size. If zero, then use the canvas size, otherwise, use this size.

### Parameters

fontSize - New value of property fontSize.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setGlow

setGlow( boolean glow ) → void

### Parameters

glow - a boolean

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setLineThickness

setLineThickness( String lineThickness ) → void

### Parameters

lineThickness - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setOverrideColors

setOverrideColors( boolean overrideColors ) → void

true will use the colors specified, otherwise the canvas colors are used.

### Parameters

overrideColors - a boolean

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setPadding

setPadding( String padding ) → void

### Parameters

padding - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setPlot

setPlot( org.das2.graph.DasPlot p ) → void

### Parameters

p - a DasPlot

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setPointAt

setPointAt( org.das2.graph.DasAnnotation.PointDescriptor p ) → void

set the thing to point at. If %p will be replaced by p.getLabel()

### Parameters

p - the thing.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setPointAtOffset

setPointAtOffset( String pointAtOffset ) → void

### Parameters

pointAtOffset - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setPointAtX

setPointAtX( Datum pointAtX ) → void

### Parameters

pointAtX - a Datum

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setPointAtY

setPointAtY( Datum pointAtY ) → void

### Parameters

pointAtY - a Datum

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setReferenceX

setReferenceX( String referenceX ) → void

single or semicolon-separated list of values.

### Parameters

referenceX - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setReferenceY

setReferenceY( String referenceY ) → void

single or semicolon-separated list of values.

### Parameters

referenceY - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setRotate

setRotate( int rotate ) → void

### Parameters

rotate - an int

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setScale

setScale( double scale ) → void

set the amount to scale the image by, if using URL to point at an image, where 0.5 is half of the original image size.

### Parameters

scale - a double

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setShowArrow

setShowArrow( boolean showArrow ) → void

### Parameters

showArrow - a boolean

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setSplitAnchorType

setSplitAnchorType( boolean splitAnchorType ) → void

### Parameters

splitAnchorType - a boolean

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setSymbol

setSymbol( org.das2.graph.PlotSymbol symbol ) → void

set the symbol used to mark the reference locations

### Parameters

symbol - a PlotSymbol

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setText

setText( String string ) → void

Set the text, which can be Granny Text. If the url property has length>0, then this is ignored.

### Parameters

string - the text

### Returns:

void (returns nothing)

### See Also:

GrannyTextRenderer
https://github.com/das-developers/das2java/wiki/Granny-Text-Strings
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setTextColor

setTextColor( java.awt.Color textColor ) → void

the color of the text, or if transparent then the border color should be used.

### Parameters

textColor - a Color

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setUrl

Deprecated: -- use text of ""

## setVerticalAnchorType

setVerticalAnchorType( org.das2.graph.AnchorType verticalAnchorType ) → void

when splitAnchorType==True, use this for the vertical position instead of the anchorType property.

### Parameters

verticalAnchorType - an AnchorType

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setXrange

setXrange( DatumRange xrange ) → void

### Parameters

xrange - a DatumRange

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setYrange

setYrange( DatumRange yrange ) → void

### Parameters

yrange - a DatumRange

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]