ContinuousLegend
Extends:
Displays a continuous legend for the parameter displayed by the given coverage data layer.
Note that this class should only be used if the palette is continuous by nature, typically having at least 100-200 color steps. If there are only a few color steps (e.g. 10), then this class will still show a continuous legend due to its rendering technique (CSS gradient based).
Example:
new C.ContinuousLegend(covLayer).addTo(map)
// changing the palette of the layer automatically updates the legend
covLayer.palette = C.linearPalette(['blue', 'red'])
var fakeLayer = {
parameter: {
observedProperty: {
label: { en: 'Temperature' }
},
unit: {
symbol: { value: 'K' },
label: { en: 'Kelvin' }
}
},
palette: linearPalette(['#FFFFFF', '#000000']),
paletteExtent: [0, 10]
}
var legend = new C.ContinuousLegend(fakeLayer).addTo(map)
// change the palette and trigger a manual update
fakeLayer.palette = C.linearPalette(['blue', 'red'])
legend.update()
Constructor Summary
Public Constructor | ||
public |
constructor(covLayer: object, options: object) Creates a continuous legend control. |
Method Summary
Public Methods | ||
public |
update() Triggers a manual update of the legend. |
Public Constructors
public constructor(covLayer: object, options: object) source
Creates a continuous legend control.
Params:
Name | Type | Attribute | Description |
covLayer | object | The coverage data layer, or any object with |
|
options | object |
|
Legend options. |
options.position | string |
|
The initial position of the control (see Leaflet docs). |
options.language | string |
|
A language tag, indicating the preferred language to use for labels. |
options.templateId | string |
|
Uses the HTML element with the given id as template. |
Public Methods
public update() source
Triggers a manual update of the legend.
Useful if the supplied coverage data layer is not a real layer and won't fire the necessary events for automatic updates.