Example: User-Defined Lattice (Butterfly Chart)

About the User-Defined Lattice Example

This example uses a butterfly chart to show the actual sales compared to the predicted sales for a line of retail products. The butterfly chart is useful for comparing two unique values. In this chart, the two values are arranged on each side of the Y axis.
Example User-Defined Lattice
Butterfly plot

Build the Graph Object for the User-Defined Lattice Example

Tip
As a shortcut, you can select a butterfly chart from the graph gallery.
  1. In the graph builder, drag and drop a bar chart from the Graph Elements pane onto the canvas.
  2. Drag and drop a second bar chart from the Graph Elements pane onto the left edge of the canvas. This action creates a new column for the second bar chart.
  3. Share the category roles. On the Role Definitions tab, click the menu down arrow next to the Category for either bar chart. Select Create Shared Role With Another Role and then select the other category role.
    The Add Shared Role window is displayed.
    Click OK.
  4. Change both bar charts to a horizontal layout.
    1. Select a bar chart.
    2. On the Properties tab, click the menu down arrow next to Direction, and select Horizontal.
    3. Repeat the previous two steps for the other bar chart.
  5. Specify a uniform column and row axis.
    1. Select the full graph. (Custom Graph should be displayed on the Properties tab).
    2. On the Properties tab, click the menu down arrow next to Y axis range (left axis only), and select Same within each row.
    3. On the Properties tab, click the menu down arrow next to X axis range, and select Same for all cells.
      The bar charts should resemble the following:
      Bar charts with uniform axes
  6. Reverse the order of the X (Measure) axis for the left bar chart.
    1. Click the horizontal axis for the left bar chart.
    2. On the Properties tab, select Reverse order.
      The bar charts resemble the following:
      Left bar chart reversed order
  7. Change the color of the right bar chart to distinguish it from the left bar chart.
    1. Select the right bar chart.
    2. On the Properties tab, click the menu down arrow next to Fill color, and select Data color 3. The right bar chart changes to a different color. In the default theme, the color is deep red.
  8. Display the grid lines for the X axes.
    1. Click the horizontal axis for the left bar chart.
    2. On the Properties tab, select Show grid lines.
    3. Repeat the previous two steps for the right bar chart.
The final graph object, complete with the legend, resembles the following:
Final butterfly graph