autumnplot-gl

Hardware-accelerated geospatial data plotting in the browser


Project maintained by tsupinie Hosted on GitHub Pages — Theme by mattgraham

autumnplot-glDocs


autumnplot-gl / makeColorBar

Function: 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.

Parameters

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);

Source

ColorBar.ts:72