Making Dimensions Independent in a Trellised Chart

Published on October 30, 2015

When you enable trellis option in a chart, you get partitions of the dataset with the same chart type, scale and axes. The dimensions are segmented into multiple sub-groups. However, each sub-group shows the entire range of dimensions despite showing measures for only a subset of the range. You can mitigate this problem by enabling independent dimension scale.

In this post, I’ll show you how to create a new trellised stacked bar chart, with independent dimension scale on dataset SFPD Reported Incidents for 2014 [data source].

Prerequisites

You must have access to the SFPD Reported Incidents 2014 dataset [data source], and you must be able to:

Q1 – January, February, March

Q2 – April, May, June

Q3 – July, August, September

Q4 – October, November, December

Create a Trellised Bar Chart

  1. Create a new Bar Chart visual.
  2. Populate the shelves from the available fields (Dimensions and Measures) listed in the left navigation menu.
    • Under Dimensions, select Segment, drag and drop it on the shelf.
    • Under Dimensions, select date, drag and drop it on the  X shelf. Make sure you have date on the right side of Segment; the left-most field controls the segmentation.
    • Under Dimensions, select pddistrict, drag and drop it on the Colors shelf.
    • Under Measures, select incidntnum, drag and drop it on the Y shelf.
  3. On the X shelf, on Segment field, click the down arrow icon, click Pick values from a list.
     
    image00

The Pick values for Segment Names window appears.

image03

  1. Under Quarters, select Q1, Q2, Q3, and Q4.
  2. Click Save.
  3. On the X shelf, on date field, click the down arrow icon, select Date/Time Functions, and then select Month.
     
    image01
  1. On the Y shelf, on incidntnum field, click the down arrow icon, select Aggregates, and then select Count.
     
    image02
  1. Click Refresh Visual.
     
    image05

The main screen shows the trellised bar chart displaying the number of reported incidents in various districts in four quarters. The X-Axis shows the entire range of months despite having values for only three months. You can change the Axis range to bring only the months with values into focus by enabling Independent Dimension Scale.

Enable Independent Dimension Scale

  1. Click Settings at the top right of the screen. The Settings modal appears.
  2. Click Axes in the Settings window. The Axes Scale options appear.
  3. On the Axes Scale options list, select Independent Dimension Scale
     
    image04
     
  4. Click Apply.
    The bar graphs in the main part of the screen now show the only dimensions with values on X-Axes.
     
    image07

     
  5. [Optional] In the Settings window, under the Axes tab, select Dynamically size graph to window size.
     
    rtaimage
     

The trellised bar chart looks like this now:

image06

Now, the trellised charts you have created shows the data by quarters, and you can see the number of incidents in each month of the quarter.