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

propertyexplanationtypedefault value
channel the visual channel of the legend
possible values: “fillColor”, “strokeColor”
String
field the data field of the legendString
fieldType the type of the data field of the legendString
id the unique id of the legendString
orientationthe orientation of the legend (“horizontal” or “vertical”)String“vertical”
strokeColorthe stroke color of the ticks in the legendColor“#555”
textColorthe text color of the legendColor“#555”
type the type of the legendString“legend”
xthe x coordinate of the left side of the legendNumber0
ythe y coordinate of the top of the legendNumber0