Class: GraphicE-mail This Topic Printable Version Give Us Feedback

Description

A Graphic can contain geometry, a symbol, attributes, or an infoTemplate. A Graphic is displayed in the GraphicsLayer. The GraphicsLayer allows you to listen for events on Graphics.

Class hierarchy

esri.Graphic

Constructor

Constructor Description
esri.Graphic(geometry, symbol, attributes, infoTemplate) Creates a new Graphic object. All parameters are required and must be specified in the order given.
esri.Graphic(json) Creates a new Graphic object using a JSON object.

Properties

Property Type Description
attributes Object Name value pairs of fields and field values associated with the graphic.
geometry Geometry The geometry that defines the graphic.
infoTemplate InfoTemplate The content for display in an InfoWindow.
symbol Symbol The symbol for the graphic.

Methods

Method Return Value Description
getContent() String Returns the content string based on attributes and infoTemplate values.
getDojoShape() dojox.gfx.Shape Returns the Dojo gfx shape of the ESRI graphic.
getTitle() String Returns the title string based on attributes and infoTemplate values.
hide() none Hides the graphic.
setAttributes(attributes) Graphic Defines the attributes of the graphic.
setGeometry(geometry) Graphic Defines the geometry of the graphic.
setInfoTemplate(infoTemplate) Graphic Defines the InfoTemplate for the InfoWindow of the graphic. When a user clicks a graphic, the InfoWindow opens with this template.
setSymbol(symbol) Graphic Sets the symbol of the graphic.
show() none Shows the graphic.
toJson() Object Converts object to its ArcGIS Server JSON representation.
Constructor Detail

esri.Graphic(geometry, symbol, attributes, infoTemplate)

Creates a new Graphic object. All parameters are required and must be specified in the order given.
Parameters:
<Geometry> geometry Required The geometry that defines the graphic.
<Symbol> symbol Required Symbol used for drawing the graphic.
<Object> attributes Required Name value pairs of fields and field values associated with the graphic.
<InfoTemplate> infoTemplate Required The content for display in an InfoWindow.

esri.Graphic(json)

Creates a new Graphic object using a JSON object.
Parameters:
<Object> json Required JSON object representing the graphic.
Properties Detail

<Object> attributes

Name value pairs of fields and field values associated with the graphic.
See also:
setAttributes  

<Geometry> geometry

The geometry that defines the graphic.
See also:
setGeometry  

<InfoTemplate> infoTemplate

The content for display in an InfoWindow.
See also:
setInfoTemplate  

<Symbol> symbol

The symbol for the graphic.
See also:
setSymbol  
Methods Detail

getContent()

Returns the content string based on attributes and infoTemplate values.
Return value: String

getDojoShape()

Returns the Dojo gfx shape of the ESRI graphic.
Return value: dojox.gfx.Shape

getTitle()

Returns the title string based on attributes and infoTemplate values.
Return value: String

hide()

Hides the graphic.
Return value: none

setAttributes(attributes)

Defines the attributes of the graphic.
Return value: Graphic
Input Parameters:
<Object> attributes Required The name value pairs of fields and field values associated with the graphic.
See also:
attributes  

setGeometry(geometry)

Defines the geometry of the graphic.
Return value: Graphic
Input Parameters:
<Geometry> geometry Required The geometry that defines the graphic.
See also:
geometry  

setInfoTemplate(infoTemplate)

Defines the InfoTemplate for the InfoWindow of the graphic. When a user clicks a graphic, the InfoWindow opens with this template.
Return value: Graphic
Input Parameters:
<InfoTemplate> infoTemplate Required The content for display in an InfoWindow.
See also:
infoTemplate  

setSymbol(symbol)

Sets the symbol of the graphic.
Return value: Graphic
Input Parameters:
<Symbol> symbol Required The symbol for the graphic.
See also:
symbol  

show()

Shows the graphic.
Return value: none

toJson()

Converts object to its ArcGIS Server JSON representation.
Return value: Object