Hardware-accelerated geospatial data plotting in the browser
autumnplot-gl • Docs
autumnplot-gl / makeColorBar
makeColorBar(
colormap
,opts
):SVGElement
Make an SVG containing a color bar. The color bar can either be oriented horizontal or vertical, and a label can be provided.
• colormap: ColorMap
The color map to use
• opts: ColorBarOptions
The options for creating the color bar
SVGElement
An SVGElement containing the color bar image.
// 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);