Creating a Chart Legend
Add a new chart legend to a traditional chart definition.
Implementation:
- Open a Chart question's Properties and click Configure to open the Chart Definition interface.
- Switch to the Legends panel.
- Click Add to open the Chart Legend dialog.
- Enter a unique Legend Name. This can be used to reference the legend elsewhere, including with the WithChartItems function.
- Choose the Legend Type to use. Table will render the legend in a grid with two columns, Column will use a single column, and Row will render it as a single row.
- (Table only) Use the Table Type drop-down menu to choose if the legend table should be Tall or Wide.
- (Optional) Tick the Automatically Size Legend Text check box if the text in the legend should automatically shrink as more items are added to it.
- (Optional) Tick the Legend Items Are Equally Spaced check box to automatically give each item in the legend the same physical space as the longest item.
- (Optional) Switch to the Appearance tab and use the options here to modify the legend's visual style.
- (Optional) Switch to the Title tab to add a title that appears above the legend, and modify its appearance.
- (Optional) Switch to the Cell Columns panel. Here, you can add and manage cell columns in the legend.
- (Optional) Switch to the Position panel.
- (Optional) Untick Enable Auto Position if you want to specify the specify the size and position of the legend yourself. This will enable the remaining options in the panel.
- (Optional) Use the X Position and Y Position sliders to set the horizontal and vertical position of the legend within the chart area. These are percentage values from 0 to 100.
- (Optional) Use the Height and Width fields to set the size of the legend in pixels.
- (Optional) Switch to the Docking panel. This contains options for docking the legend to a particular chart area in the definition. The legend will still display data from the series it is associated with, but will appear next to the specified area.
- (Optional) Tick the Dock to Chart Area check box to activate the remaining options in the panel.
- (Optional) Switch to the Interactivity panel, where you can add interactive elements to the legend.
- Click Save to create the new legend.