Simple steps to innovate legend design layout
Have you ever been short on real estate when designing a dashboard? When it comes to legends, we find it difficult to space just right so that the labels display legibly without wasting too much space. In this blog we will show simple steps to display color codes for values. We believe it is a more efficient layout that you can get creative with.
First example of a standard vertical legend. Legend occupies valuable space, labels are duplicated, and text labels are truncated.
Second example of a horizontal legend. Legend is still not wide enough to display the entire values. Colors are aligned the same order as on the axis but this layout requires 'eye-shifting' between legend colors and data line colors.
Still inspired by Edward Tufte's concepts (link to blog), we recommend creating a customized bar chart that serves as the axis label and color legend.
This solution integrates Tufte design principals to provide a better user experience. Features and benefits include:
- Display data clearly - Enable the reader to focus on data and visual
- Display full text value instead of trimmed values - Provide full information
- Reduce chart junk - De-dup labels on axis and legend frees up valuable space
- Eliminate overload - Align colors and values more intuitively, removing the burden of looking across multiple places for labels and associated colors.
- Design clearly - Customizable format and layout
Let's walk through the steps to implement. Please note, throughout the example, we use Legend Label field as the dimension and Number of Records as the measure.
Step 1 Create a bar chart
Drag Number of Records to column shelf. Drag Legend Label to rows shelf
Step 2 Change Number of Records aggregation
Right click green Number of Records pill, change Number of Records aggregate from default to Minimum
Step 3 If it is not already, set Mark to Bar
Step 4 Add Legend labels to bar text
Drag Legend Label to Label text card (format, align)
Step 5 Hide Bar Chart object title
In title, right click, hide title
Step 6 Hide row header
Right click Label Dimension pill, unclick Show Header
Step 7 Freeze the x-axis
Right click x axis, General tab - Click Fixed button - Fixed start = 0 Fixed end =1, click apply
Step 8 Hide axis labels
Right click x-axis, uncheck Show Header
Step 9 Set color legend
Drag Legend Dimension to Color card. Double click Color shelf to edit/assign custom colors, format text label
Step 10 Size legend bars accordingly
Right click Size card and adjust. Adjust height of bars.
Pro tip - add context to bar chart/legend by adding metric to bar chart legend: Drag metric to label
Step 11 Add legend bar chart to dashboard visual
Format accordingly
Pro tip - align with visual: Set Legend object to floating, bring forward
Pro tip - avoid scroll bars: Right click Bar Chart object: Fit - Entire View
Compare results
Standard legend:
Customized bar chart axis and legend:
Use your own style to display a clean, clearly formatted, and legible legend. Happy developing!