Module: svgLegend

Type Definitions

legendOpts

Type:
  • Object
Properties:
Name Type Description
display boolean indicates whether or not a legend is to be drawn.
scale number a number between 0 and 1 which scales the size of the legend.
x number an offset of the top-left corner of the legend from the left margin of the SVG.
y number an offset of the top-left corner of the legend from the top margin of the SVG.
width number can be used to specify a width (for leaflet legend).
height number can be used to specify a height (for leaflet legend).
data legendDefintion a legend defition.
Source:

legendDefintion

Type:
  • Object
Properties:
Name Type Description
title string a title caption for the legend.
colour string a colour for the legend symbols which can be hex format, e.g. #FFA500, RGB format, e.g. rgb(100, 255, 0) or a named colour, e.g. red. (Can be overriden by individual legend lines.)
colour2 string second colour for legend symbols of bullseye shape which can be hex format, e.g. #FFA500, RGB format, e.g. rgb(100, 255, 0) or a named colour, e.g. red. (Can be overriden by individual legend lines.)
stroke string a colour for the border of the legend symbols which can be hex format, e.g. #FFA500, RGB format, e.g. rgb(100, 255, 0) or a named colour, e.g. red. (Can be overriden by individual legend lines.) If not specified, no border is drawn.
shape string describes symbol shapes for the legend. Valid values are: circle, bullseye, square, diamond, triangle-up, triangle-down. (Can be overriden by individual legend lines.)
size number a number between 0 and 1. This can be used to scale the size of the legend dots. (Can be overriden by individual legend lines.)
opacity number a number between 0 and 1 indicating the opacity of the legend symbols for the whole legend. 0 is completely transparent and 1 is completely opaque. (Can be overriden by individual legend lines.)
padding number a number that indicates the padding, in pixels, that should be used between the elements of a legend line (e.g. the symbol and the text).
raligned Array.<boolean> an array of boolean values to indicate whether text elements in a tabulated legend lines should be right-aligned.
lines Array.<legendLine> an arry of objects representing lines in a legend.
Source:

legendLine

Type:
  • Object
Properties:
Name Type Description
colour string a colour for the legend symbol which can be hex format, e.g. #FFA500, RGB format, e.g. rgb(100, 255, 0) or a named colour, e.g. red. Overrides any value set for the whole legend.
colour2 string second colour for legend symbols of bullseye symbol which can be hex format, e.g. #FFA500, RGB format, e.g. rgb(100, 255, 0) or a named colour, e.g. red. Overrides any value set for the whole legend.
stroke string a colour for the border of the legend symbol which can be hex format, e.g. #FFA500, RGB format, e.g. rgb(100, 255, 0) or a named colour, e.g. red. Overrides any value set for the whole legend. If not specified, no border is drawn.
shape string describes symbol shape for the legend line. Valid values are: circle, bullseye, square, diamond, triangle-up, triangle-down. Overrides any value set for the whole legend.
size number a number between 0 and 1. This can be used to scale the size of the legend dots. Overrides any value set for the whole legend.
opacity number a number between 0 and 1 indicating the opacity of the legend symbol. 0 is completely transparent and 1 is completely opaque. Overrides any value set for the whole legend.
underline boolean If set to true, indicates that the legend line is to be underlined.
text string | Array.<string> Specifies the text for the legend line either as a single text string or an array of strings for a tabulated legend layout. For tabulated legend layout, one of the strings can be set to the special value of 'symbol' to indicate the position where the legend symbol should be generated in the tabualted layout. In a tabulated legend layout, the various array elements in each line are aligned with those in the other lines to form columns. You can use the HTML tags '' and ' to italicise and bolden text in the legend lines.
key string a string key to match legend items to map dots. Only required if legend interactivity is required. If used then each element in the data for the map must have a property called 'legend-key' which is used to match against this value.
Source: