Syntax
Shade [ Window window_id ]
{ layer_id | layer_name }
With expr
Density dot_value { Circle | Square }
Width dot_size
[ Color color ]
window_id is the integer window identifier of a Map window.
layer_id is the layer identifier of a layer in the Map (one or larger).
layer_name is the name of a layer in the Map.
expr is the expression by which the table will be shaded, such as a column name.
dot_value is the numeric value associated with each dot in a dot density map.
dot_size is the size, in pixels, of each dot on a dot density map.
color is the RGB value for the color of the dots in a dot density map.
Description
The optional window_id clause identifies which Map is to be shaded; if no window_id is provided, MapBasic shades the topmost Map window.
The Shade statement must specify which layer to shade thematically, even if the Map window has only one layer. The layer may be identified by number (layer_id), where the topmost map layer has a layer_id value of one, the next layer has a layer_id value of two, etc. Alternately, the Shade statement can identify the map layer by name (for example, "world").
Each Shade statement must specify an expr expression clause. MapInfo Pro evaluates this expression for each object in the table being shaded; following the Shade statement, MapInfo Pro chooses each object's display style based on that record's expr value. The expression typically includes the names of one or more columns from the table being shaded.
The keywords following the expr clause dictate which type of shading MapInfo Pro will perform. The Density keyword creates a dot density map.
For the specific syntax of a Dot Density map, see Syntax Dot Density.
In a Density map, the keyword Density is followed by a dot_value clause. You can specify either a Circle or Square thematic style. Note that a map layer must include regions in order to provide the basis for a meaningful dot density map; this is because the number of dots displayed in each region represent some sort of density value for that region. For example, each dot might represent one thousand households.
In a dot density map, a numeric expr value is calculated for each region; the dot_value represents a numeric value as well. MapInfo Pro decides how many dots to draw in a given region by dividing that region's expr value by the map's dot_value setting. Thus, if a region has an expr value of 100, and the Shade statement specifies a dot_value of 5, then MapInfo Pro draws 20 dots in that region, because each dot represents a quantity of 5.
The keyword Width is followed by dot_size. This specifies how large the dots should be, in terms of pixels. For Circle dot style, the dot_size can be 2 to 25 pixels in width. For Square dot style, the dot_size can be 1 to 25 pixels. The optional Color clause is used to set the color of the dots.
The following example creates a dot density map using the States table's Pop_1990 column, (which in this case indicates the number of households per state, circa 1990). The resultant dot density map will show many 4-pixel dots; each dot representing 60,000 households.
Open Table "states"
Map From states
shade window 176942288 7
with Pop_1990
density 600000 circle width 4
color 255