Skip to main content

Function: makePaintballKey()

makePaintballKey(colors, labels, opts?): SVGElement

Defined in: ColorBar.ts:316

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

Parameters

ParameterTypeDescription
colors(string | Color)[]A list of colors
labelsstring[]The labels corresponding to each color
opts?PaintballKeyOptionsThe 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);