Is that a table?

Not all tables are meant to display numbers. Actually, with a little creativity and some advanced customization, you can create amazing visualizations that will enhance your applications and give a fresh look to your dashboards.

The waffle chart

For a strange reason, it looks like most area-based graphics have something to do with food. However, this time, we are not talking about pies or doughnuts, but waffle charts. These visualizations are based on a pivot table and rely on cell customization to display a percentage.

Example: Waffle chart.

Relevant features: ValueLoop(), RowNo(), and ColumnNo().

The waffle chart

Unlike most visualizations, the construction of the waffle chart is a little unorthodox because it is based on two synthetic dimensions (that is, they don't exist in the data model) and a dummy expression. Our objective is to create a matrix with 100 cells that will be displayed in different colors depending on a metric. In order to create a waffle chart, do the following:

  1. First, let's create a new pivot table using a calculated dimension:
    =ValueLoop(1,  10) 

    Note

    The ValueLoop() function returns a set of iterated values ranging from the first to the second parameters. Thus, the preceding calculation returns a list that goes from 1 to 10.

  2. Create a second calculated dimension using exactly the same formula.
  3. Let's move on to the expressions. Due to the nature of this chart, we will use the following calculation (yes, it's only a space):
    ' '
  4. Expand the whole table by opening the contextual menu (right-clicking on the first column) and select Expand all.
    The waffle chart
  5. Drag and drop the second dimension in order to create a cross table:
    The waffle chart
  6. Now, let's color the cells based on a metric. Go to the Expressions tab and click on the Expression Expansion icon.
  7. Add the following formula to the Background Color parameter:
    if(((RowNo() - 1) * 10) + ColumnNo() > 
    (1 - avg(Waffle)) * 100     // Your KPI
    , RGB(145, 180, 200))       // Color

    Note

    The trick behind this chart is to assign a number to each cell and compare it against the desired KPI. In our case, this number is calculated by multiplying the row number times 10 and then adding the column number, as in the following image:

    The waffle chart
  8. Now, let's clean the chart. In order to get rid of the column headers, go to the Dimensions tab and type a space in the Label field (both dimensions).
    The waffle chart
  9. Go to the Caption tab and disable the Show Caption box.
  10. Remember the Custom Format Cell menu that we discussed in the last chapter? Well, it's time to put it to use. Modify both dimensions so that Background Color is gray and Text Color is totally transparent, as in the following screenshot:
    The waffle chart
  11. Adjust the columns' width as you prefer (whether you want squares or rectangles).
  12. We have baked a great waffle chart. Bon appétit!

    Tip

    Unfortunately, it is impossible to delete the gray cells without impacting the rest of the table. However, if you really want to remove them, you can create two white text objects to cover them.

Table infographics

Based on the same rationale as the one behind a waffle chart, it is possible to create certain types of infographics. The only difference is that instead of using color to display a metric, this graphic displays different images. Though its data-ink ratio will be shockingly low, this visualization is definitely eye-catching and might be useful for specific audiences. (If anyone asks, you didn't hear this one from me.)

Table infographics

Heat maps

Heat maps are one of the most interesting visualizations that can be created upon tables. They display information by coloring a matrix based on a calculation; as the color becomes darker, the magnitude behind it is greater. Though this graphic is not among the most accurate representations of data, it is still very useful to understand distributions and behaviors.

Example: A restaurant wants to spot the busiest hours of the week in order to hire more chefs and waiters so that the quality of the service remains always the same.

Relevant features: ColorMix1().

Heat maps

In order to create such a heat map, do the following:

  1. Create a new pivot table using WeekDay and Hour as the dimensions.
  2. Our visualization will be based on the average number of customers per day. However, it will only be used for the background color, so let's create a dummy expression by typing ' ' (Yep, again, only a space).
  3. Drag the Hour column to the upper border in order to create a cross table, as shown in the following image:
    Heat maps
  4. In order to give color to each cell, we will use ColorMix1(). This function creates a gradient between two colors based on a number that goes from zero to one, for example:
    Heat maps
  5. We know that the most intense cell should be the day/hour with the most customers in the whole week. Therefore, we can calculate the ratio we need by dividing each cell by the maximum value of the table:
    avg(Customers) / 
    $(=max(aggr(avg(Customers), WeekDay, Hour))) 

    Note

    The aggr() function allows us to iterate over WeekDay and Hour, so we can select their maximum value (something similar to a GROUP BY clause in the script). It is important to highlight that it is mandatory to use the dollar sign expansion here because we need this expression to be calculated at a global level and not in each cell.

  6. Now, let's combine this calculation with the ColorMix1()function. Click on the Expression Expansion icon, open the Background Color parameter, and type the following formula:
    ColorMix1(
    avg(Customers) / 
    $(=max(aggr(avg(Customers), WeekDay, Hour))), white(), RGB(0, 70, 140)) 
  7. Go to the Presentation tab and change the cell height by selecting both boxes in the Multiline Settings grouping:
    Heat maps
  8. Once again, you can hide the dimension's header by using a space as the label (Dimensions tab).
    Heat maps
  9. Adjust the column's size, alignment, and any other element that deserves your attention.
  10. Done! Our heat map is now ready to go.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset