var colorScale = new Plottable.Scales.Color();
var legend = new Plottable.Components.Legend(colorScale);
colorScale.domain(["First", "Second"]);
legend.xAlignment("center");
legend.yAlignment("center");
legend.renderTo("svg#example");
.colorScale()
/.colorScale(scale)
Gets/sets the color scale to be used with the Legend.
.comparator()
/.comparator(comparator)
Gets/sets the current comparator for the Legend's entries. The comparator is used to set the display order of the entries.
.entitiesAt(point)
Gets the Entities (representing Legend entries) at a particular point. Returns an empty array if no Entities are present at that location
.maxEntriesPerRow()
/.maxEntriesPerRow(numEntries)
Gets/sets the maximum number of entries per row.
.symbol()
/.symbol(symbolFunction)
Gets/sets the function that determines the symbols of the legend. The function takes a datum and an index and returns a SymbolFactory. Six SymbolFactories are currently supported
Plottable.SymbolFactories.circle()
Plottable.SymbolFactories.square()
Plottable.SymbolFactories.cross()
Plottable.SymbolFactories.diamond()
Plottable.SymbolFactories.triangleUp()
Plottable.SymbolFactories.traingleDown()