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 / makePaintballKey

Function: makePaintballKey()

makePaintballKey(colors, labels, opts?): SVGElement

Make an SVG containing a color key for a paintball plot. The key can be split over any number of columns.

Parameters

colors: (string | Color)[]

A list of colors

labels: string[]

The labels corresponding to each color

opts?: PaintballKeyOptions

The options for creating the color key

Returns

SVGElement

An SVGElement containing the color bar image.

Example

// Create the color key
const svg = makePaintballKey(colors, labels, {n_cols: 2, fontface: 'Trebuchet MS'});

// Add the color key to the page
document.getElementById('pb-key-container').appendChild(svg);

Source

ColorBar.ts:289