Description
Class added v2.1dojo.require("esri.dijit.Scalebar");The scalebar dijit displays a scalebar on the map or in a specified HTML node. The dijit respects various coordinate systems and allows you to display the units in miles or kilometers.
The following table lists the CSS class names used by the scalebar
to refer to the DOM nodes it creates. The class names can be used to customize
the look and feel of the widget.
CSS Classes
|
esriScalebar
|
Represents the scalebar dijit. In this snippet, padding is added around the scalebar.
.esriScalebar{padding: 20px 20px;}
|
|
esriScalebarRuler
|
Represents the scalebar ruler. Use this CSS class to define the background color and border of the ruler.
|
|
esriScalebarLabel
|
Represents the scalebar labels. Use this CSS class to define the font and color of the labels.
|
|
esriScalebarLabel
|
Represents the scalebar ruler blocks. Use this CSS class to define the color of the ruler blocks.
|
Samples
Search for
samples that use this class.
Class hierarchy
esri.dijit.Scalebar
Constructor
Methods
| hide() |
none
|
Hide the scalebar dijit. |
| show() |
none
|
Set the scalebar's visibility to true. This method only applies if the scalebar has been hidden using scalebar.hide. |
Constructor Detail
esri.dijit.Scalebar(params, srcNodeRef?)
Creates a new Scalebar dijit. The Scalebar constructor should be called after the map is loaded, e.g., in the map's onLoad event.
Parameters:
|
<Object>
params |
Required |
Parameters used to configure the widgit. See the list below for details.
|
|
<String>
srcNodeRef |
Optional |
Reference or id of the HTML element where the widget should be rendered.
|
Options:
|
<String>
attachTo |
Specify the scalebar position on the map. Valid options are "top-right","bottom-right","top-center","bottom-center","bottom-left","top-left". The default value is "bottom-left".
|
|
<Map>
map |
Reference to the map. The map parameter is required.
|
|
<String>
scalebarUnit |
Specify the scalebar units. Valid values are "english" or "metric". The default value is "english".
|
Code snippets:
var scalebar = new esri.dijit.Scalebar({map:map,attachTo:"top-right"});
Methods Detail
Hide the scalebar dijit.
Return value: none
Code snippets:
scalebar.hide();
Set the scalebar's visibility to true. This method only applies if the scalebar has been hidden using scalebar.hide.
Return value: none
Code snippets:
scalebar.show();