Skip to content
ElenaPochernina edited this page May 26, 2016 · 3 revisions

Legend shows additional information about plot, for example name, color or size information. Legend is dynamic: it changes with data changings to show only actual information. There are two types of legends:

  • Compact legend is used by IDD as default legend. It allows to show and hide certain plots.
  • Extended legend is used by Chart Viewer as default legend. It allows to show and hide certain plots and reorder plots in a legend to change z-index of plots.

Legend of a specific plot can be shown in any DIV element (it can be placed either inside or outside of the plot) by setting attribute “data-idd-legend”. Value of this attribute should be the id of a DIV element for legend. Master plot merges all legends of its dependent plots into one. Only chart has predefined legend. The content of legend DIV can be changed by overwriting getLegend() method of plot. This method should return jQuery DIV element containing legend content. Legend can be made invisible by changing “isVisible” property (chart has specific style field “isLegendVisible” for this purpose). To remove legend from DIV element call remove() method. An example of creating legend for figure:

<div data-idd-plot="figure" data-idd-legend="legend" style="width: 500px; height: 200px">
  <div id="line" data-idd-plot="polyline" data-idd-style="stroke: blue"></div>
  <div id="legend" style="float: left"></div>
</div>

You can also add legend into DIV element by using InteractiveDataDisplay.Legend(plotDiv, legendDiv, isCompact). This function creates legend for plots in plotDiv element and put it in legendDiv element. If isCompact is true the function creates compact legend otherwise extended legend.

Clone this wiki locally