Function: makeColorBar()
makeColorBar(
colormap
,opts
):SVGElement
Defined in: ColorBar.ts:95
Make an SVG containing a color bar. The color bar can either be oriented horizontal or vertical, and a label can be provided.
Parameters
Parameter | Type | Description |
---|---|---|
colormap | ColorMap | The color map to use |
opts | ColorBarOptions | The options for creating the color bar |
Returns
SVGElement
An SVGElement containing the color bar image.
Example
// Create the color bar
const svg = makeColorBar(color_map, {label: 'Wind Speed (kts)', orientation: 'horizontal',
fontface: 'Trebuchet MS'});
// Add colorbar to the page
document.getElementById('colorbar-container').appendChild(svg);