VisualVariablesMixin.jsdoc
6.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/**
* @module esri/renderers/VisualVariablesMixin
* @mixin
*/
////////////////////////////////////////////////////////////
//
// Properties
//
////////////////////////////////////////////////////////////
/**
* Visual variables define the parameters
* for data-driven geographic visualizations of numeric data. They allow you to
* easily map continuous ramps of {@link module:esri/renderers/Renderer~ColorVisualVariable color}, {@link module:esri/renderers/Renderer~SizeVisualVariable size},
* {@link module:esri/renderers/Renderer~OpacityVisualVariable opacity}, and/or {@link module:esri/renderers/Renderer~RotationVisualVariable rotation} to minimum and maximum data values
* of one of the layer's numeric attribute fields.
*
* Visual variables can primarily be used in two ways.
*
* #### 1. Thematic mapping
*
* Visual variables allow you to easily create stunning visualizations
* based on thematic attributes (e.g. population, education, rank, money, magnitude, etc.) in
* either 2D or 3D. This is accomplished by mapping data values from a numeric field attribute
* to color, size, and/or opacity values.
* The renderer then takes over and re-sizes or shades features based on the value of the given
* field and its position relative to the minimum and maximum values. The sample below uses
* three visual variables (size, color, and opacity).
*
* [](../sample-code/visualization-multivariate-2d/index.html)
*
* #### 2. Mapping real-world sizes
*
* The {@link module:esri/renderers/Renderer~SizeVisualVariable size} visual variable can be used to
* visualize the true sizes of features (e.g. tree canopy, road width, building height, etc.)
* based on their size in the real world. This can be particularly powerful when working in a 3D
* {@link module:esri/views/SceneView}. The image below shows a layer of building footprints
* that uses visual variables to extrude each feature to the true height of the buildings
* based on data stored in an attribute field.
*
* [](../sample-code/visualization-buildings-3d/index.html)
*
* The `visualVariables` property of the renderer is an array of objects called "visual variables".
* Each object must indicate
* the type of visual variable to apply (e.g. color, size, opacity, rotation), the numeric
* field from which to drive the visualization, and the ramp of visual values to map to the data.
* The following list identifies each visual variable type and provides a link to the specification table
* of each.
*
* Type | Object Specification | Legend Example
* -----|----------------------|---------------
* color | {@link module:esri/renderers/Renderer~ColorVisualVariable ColorVisualVariable} | 
* size | {@link module:esri/renderers/Renderer~SizeVisualVariable SizeVisualVariable} | 
* opacity | {@link module:esri/renderers/Renderer~OpacityVisualVariable OpacityVisualVariable} | 
* rotation | {@link module:esri/renderers/Renderer~RotationVisualVariable RotationVisualVariable} | -
*
* See the [Visualize features with realistic 3D symbols](../sample-code/visualization-trees-realistic/index.html)
* for an example of using multiple visual variables to visualize your data.
*
* @name visualVariables
* @memberof module:esri/renderers/VisualVariablesMixin
* @type {Object[]}
*
* @see [Creating visualizations manually](../guide/creating-visualizations-manually/index.html)
* @see [Visualization overview](../guide/visualization-overview/index.html)
*/
////////////////////////////////////////////////////////////
//
// Public methods
//
////////////////////////////////////////////////////////////
/**
* Indicates if the renderer has defined [visualVariables](#visualVariables).
*
* @method hasVisualVariables
* @memberof module:esri/renderers/VisualVariablesMixin
* @ignore
*
* @param {string} type - can be one of: size, color, opacity, rotation (optional)
* @param {(Object|boolean)} target - can be: false or "outline" (optional)
* @return {boolean} If `true`, then the renderer has at least one visual variable.
*/
/**
* Returns the visual variables of the specified type.
*
* @method getVisualVariablesForType
* @memberof module:esri/renderers/VisualVariablesMixin
* @ignore
*
* @param {string} type - The type of visual variables desired.
* <br><br>**Known Values:** color | size | opacity | rotation
* @return {Object[]} Returns the visual variables associated with the input `type`.
*
* @see [visualVariables](#visualVariables)
* @example
* var colorVisVars = renderer.getVisualVariablesForType("color");
*/
/**
* Returns the symbol size (in pixels) for the input graphic.
*
* @method getSize
* @memberof module:esri/renderers/VisualVariablesMixin
* @ignore
*
* @param {module:esri/Graphic} graphic - The graphic for which you want
* to calculate the symbol size.
*
* @return {number} The size of the input graphic's symbol in pixels.
*/
/**
* Returns the color of the symbol used to render the input Graphic.
*
* @method getColor
* @memberof module:esri/renderers/VisualVariablesMixin
* @ignore
*
* @param {module:esri/Graphic} graphic - The graphic from which to get the symbol's color.
*
* @return {module:esri/Color} The color used in rendering the input graphic.
*/
/**
* Returns the opacity value for the specified graphic.
*
* @method getOpacity
* @memberof module:esri/renderers/VisualVariablesMixin
* @ignore
*
* @param {module:esri/Graphic} graphic - The graphic from which to get an opacity value.
*
* @return {number} The opacity value of the input graphic.
*/
/**
* Returns the rotation angle used in rendering the input graphic.
*
* @method getRotationAngle
* @memberof module:esri/renderers/VisualVariablesMixin
* @ignore
*
* @param {module:esri/Graphic} graphic - The graphic from which to get a rotation value.
*
* @return {number} The rotation angle of the symbol used to render the input graphic.
*/
/**
* Returns the symbol used by the input graphic.
*
* @method getSymbol
* @memberof module:esri/renderers/VisualVariablesMixin
* @ignore
*
* @param {module:esri/Graphic} graphic - A graphic from which to get a symbol.
*
* @return {module:esri/symbols/Symbol} Returns the symbol used to render the input graphic.
*/