Legend
The Legend class represents a legend for a color encoding. To create a Legend object, use the legend method in the Scene class, for example:
let legend = scene.legend("fillColor", "names", {x: 100, y: 300});
Properties
property | explanation | type | default value |
---|---|---|---|
id | the unique id of the legend | String | |
type | the type of the legend | String | “legend” |
channel | the visual channel of the legend possible values: “fillColor”, “strokeColor” | String | |
field | the data field of the legend | String | |
fieldType | the type of the data field of the legend | String | |
x | the x coordinate of the left side of the legend | Number | 0 |
y | the y coordinate of the top of the legend | Number | 0 |
orientation | the orientation of the legend (“horizontal” or “vertical”) | String | “vertical” |
textColor | the text color of the legend | Color | “#555” |
strokeColor | the stroke color of the ticks in the legend | Color | “#555” |