Maptitude GISDK Help

CreateLegend()

Summary

Creates a map legend.

 

Changes

In Version 5.0 added Locked option.

 

Syntax

CreateLegend (string map_name, array settings, array options)

 

Argument Contents
map_name The name of the map
settings Required information about the legend (see table below)

 

Settings Element Type Contents
1 String Type of legend ("Automatic", "Manual", or "None", where "None" creates a legend based on the given settings and options but does not display it)
2 Array Six flags indicating the legend contents (see table below)
3 Array Three flags indicating legend style (see table below)
4 Array Four font strings indicating the font to use for the legend title, footnote, subtitles, and items
5 Array Two strings containing the legend title and footnote

 

Contents Flags Type Contents
1 Integer Whether to display a title (1 or 0)
2 Integer Whether to display a footnote (1 or 0)
3 Integer Whether to display layer information (1 or 0)
4 Integer Whether to display set information (1 or 0)
5 Integer Whether to display theme information (1 or 0)
6 Integer How to display the scale of miles (0 for none, or 1-6 indicating the style to use)

 

Style Flags Type Contents
1 Integer Whether the legend is attached to the map or in a separate window (1 or 0)
2 Integer Whether the legend is framed (1 or 0)
3 Integer Whether the background is filled (1) or transparent (0). If the background is filled (the default), a background style and background color must be specified as options in the options array

 

Option Type Contents
Layer Subtitle String Text for the layer information subtitle (defaults to "Map Layers")
Click Macro String Macro to run when the user double-clicks on a legend that is in its own window (use annotation handling for legends that are attached to the map)
Background Color Color Color of the legend background
Background Style Fillstyle Fill style of the legend background
Border Color Color Color of the legend frame
Border Style Linestyle Line style of the legend frame
Border Width Integer Width of the legend frame
Title Color Color Color of the title font
Footnote Color Color Color of the footnote font
Headings Color Color Color of the headings (subtitles) font
Standard Color Color Color of the standard (items) font
Scale Color Color Color of the scale bar
Columns Integer Number of legend columns (default=1)
Column Order String "Rows" to order items across rows or "Columns" to order items down columns
Locked Boolean If "True" the close box on legends in a separate window is disabled; the default is "False"

 

Notes

Example

CreateLegend("My Map", {"Automatic",

     {1, 1, 0, 0, 0, 4},

     {1, 1, 1},

     {"Arial|16", "Arial|14", "Arial|Italic|12", "Arial|12"},

     {"This is My Legend", "This legend created with GISDK"}

     },)

 

Error Codes

Error Type Meaning
Error The settings array does not have the correct number of items, or one of the items or options is invalid
NotFound The named map does not exist

 

See Also

Function Summary
DestroyLegend() Destroys a map legend
GetLegendOptions() Gets the values of one or more options for a map legend
GetLegendSettings() Gets the settings for a map legend
SetLegendOptions() Changes the option settings for a map legend
SetLegendSettings() Changes the settings for a map legend

 

 

©2025 Caliper Corporation www.caliper.com