Methods
# static prepareLegends(legends, palettes, columnInfo)
Validate user-provided legend options and prepare legends for rendering. A legend is necessary for each palette used in the visualization. If user have not provided legend configuration for a palette that is used in ColumnInfo, it will be added automatically.
Parameters:
Name | Type | Description |
---|---|---|
legends |
Array.<module:legends~LegendInfo>
|
user provided legend configuration |
palettes |
module:palettes~PaletteMapping
|
mapping of names to palette colors |
columnInfo |
Array.<module:columns.Column>
|
user provided information on columns |
Type Definitions
Object
# LegendInfo
Legend configuration
Properties:
Name | Type | Description |
---|---|---|
title |
string
|
title of the legend, defaults to palette name |
palette |
string
|
name of the palette to use |
geom |
string
|
type of geom to use for legend. If absent, will be copied from the first column info with the same palette |
labels |
Array.<string>
|
labels for the legend. Required for |
label_align |
'left'
|
'center'
|
'right'
|
alignment of the labels. Defaults to |
label_hjust |
number
|
numerical alias for |
size |
number
|
Array.<number>
|
size of the legend elements. Required for |
values |
number
|
Array.<number>
|
values for the legend elements. For numeric geoms represents
color values for the legend elements. Must be the same length as |