require(["esri/renderers/ScaleDependentRenderer"], function(ScaleDependentRenderer) { /* code goes here */ });
Description
(Added at v3.7)
ScaleDependentRenderer provides the capability to apply multiple scale-dependent renderers to a layer. Each renderer is only applied to the layer at specific scale range or zoom range.
More information on working with rendering, smart mapping, and using visual variables can be found in the
Data Visualization guide topic and the multiple samples referenced within this topic.
Samples
Search for
samples that use this class.
Class hierarchy
esri/renderers/Renderer
|_esri/renderers/ScaleDependentRenderer
Constructors
Properties
rangeType | String | Indicates whether rendererInfos uses zoom range or scale range. |
rendererInfos | Object | An array of objects, where each object defines a renderer and the zoom/scale range to which it applies. |
Methods
Constructor Details
Create a ScaleDependentRenderer.
Parameters:
<Object > options |
Optional |
Various options to configure this renderer. See the list below for details. |
options
properties:
<Object[] > rendererInfos |
Optional |
An array of objects where each object defines a renderer and the zoom or scale range to which it applies.
- All objects must have either a zoom range or scale range. You cannot define
rendererInfos with a mixture of zoom range and scale range.
- When using zoom range, make sure it falls within the min zoom and max zoom values allowed by the map.
rendererInfos: [
{
"renderer": <Renderer>,
"minZoom": <Number>,
"maxZoom": <Number>,
},
...
]
or
{
"renderer": <Renderer>,
"minScale": <Number>,
"maxScale": <Number>,
},
...
|
Sample: var renderer1 = new DotDensityRenderer({
fields: [{
name: "M163_07",
color: new Color([52, 114, 53])
}],
dotValue: 4000,
dotSize: 2
});
var renderer2 = new DotDensityRenderer({
fields: [{
name: "M163_07",
color: new Color([52, 114, 53])
}],
dotValue: 1000,
dotSize: 2
});
var scaleDependentRenderer = new ScaleDependentRenderer({
rendererInfos: [{
renderer: renderer1,
maxScale: 10000000,
minScale: 20000000
}, {
renderer: renderer2,
maxScale: 5000000,
minScale: 10000000
}]
});
layer.setRenderer(scaleDependentRenderer);
Property Details
Indicates whether rendererInfos
uses zoom range or scale range.
Known values: "zoom" | "scale"
An array of objects, where each object defines a renderer and the zoom/scale range to which it applies.
Method Details
Adds the specified renderer info to the array of existing renderers. In order to view the change call the GraphicsLayer redraw
method.
Parameters:
<Object > info |
Required |
An object as defined in the rendererInfos property. |
Gets the color for the Graphic. (Added at v3.8)
Returns the opacity value for the specified graphic. This is calculated using the
opacityInfo definition.
(Added at v3.11) Parameters:
<Graphic > graphic |
Required |
Returns the opacity value appropriate for the given graphic. This value is calculated based on the opacityInfo definition. |
<Object > options |
Optional |
This optional parameter supports opacityInfo . If none is provided, the Renderer.opacityInfo will be used. |
Returns the renderer info for the input graphic. Note that the graphic should be part of a GraphicsLayer (or one of its sub-classes) that is added to the map.
Parameters:
<Graphic > graphic |
Required |
The graphic for which you want to get renderer info. |
Returns the renderer info for the specified scale.
Parameters:
<Number > scale |
Required |
Returns the renderer info for the specified scale. |
Returns the rendererInfo for the specified zoom level.
Returns the angle of rotation (in degrees) for the graphic calculated using rotationInfo. (Added at v3.7)
Return the symbol size (in pixels) for the graphic, calculated using sizeInfo
. (Added at v3.7)
Parameters:
<Graphic > graphic |
Required |
The graphic for which you want to calculate the symbol size. |
<Object > options |
Optional |
This optional parameter supports sizeInfo . If none is provided, the Renderer.sizeInfo will be used.
|
Gets the symbol for the Graphic.
Parameters:
<Graphic > graphic |
Required |
Graphic to symbolize. Used when creating a custom renderer. |
Replaces existing rendererInfos with new ones. The infos
argument is an array of objects as described in the rendererInfos
property.
For the changes to take effect, call GraphicsLayer redraw
after calling this method.
Parameters:
<Object > infos |
Required |
An array of objects as defined in the rendererInfos property. |
Converts object to its ArcGIS Server JSON representation. (Added at v2.1)