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