This sample demonstrates how to add a Legend fora WebMap Layer to a 2D MapView. The map shows predominant educational attainment with darker colors indicating a stronger predominance.
The Legend widget can also be added to a 3D SceneView. You can use DefaultUI.add() method to add Legend to the UI. The widget renders inside its own DOM node nested within the view node. Legend must reference its respective View through the view
property of the widget constructor object.