Tag Archives: panel charts

Text Wrapping within Tableau Panes

I recently got a request for help with a wrapping challenge. Not holiday presents, instead text wrapping in Tableau. Here’s a demo view illustrating the problem:

There’s a whole bunch of ellipses (…) where there’s too much data to display. The only options Tableau gives us in this case are to:

  • Change the order of the text by sorting the Product Name dimension.
  • Manually change the size of each pane by resizing the headers.
  • Use the Fit options to dynamically Fit Width, Fit Height, or Entire View.

The manual sizing is problematic because it won’t dynamically adjust to the number of marks, and in the case of views with lots of marks like this one it takes a lot of effort to figure out what size will get all the marks, never mind that the list of values is really hard to read:

And while the Fit options are great at ensuring a view with only a few marks takes up the available space when there are many marks it ends up either not displaying values or creating overlapping values depending on the settings.

Controlling X + Y

In this view the mark layout–either no pills or only discrete (blue) pills on Rows and Columns– is generating a pane for each distinct combination of header values and then Tableau’s mark stacking algorithm is laying out the text. So at this point we’re stuck and can’t do anything about what Tableau is up to. This is where we need to keep in mind one of the master Tableau concepts: everything is a scatterplot. If Tableau won’t place the marks where we want them then we can generate our own X + Y coordinates whether by adding data or creating our own calculations. This is the approach taken by the tile maps introduced to Tableau by Brittany Fong or or as a model of the solar system that I made awhile back: . More recently Ken Flerlage did a great introduction on his Beyond Show Me series of blog posts.

Therefore “all” we need to do is figure out where to place the marks. More on that in a moment, there are two more details I want to go into:

Green Panes vs. Blue Panes: Pane Sizing

Tableau’s logic around what generates a pane vs. marks in a pane is a little complicated so I’m going to keep this focused on three key elements, here are the first two:

  1. All panes created by a given combination of pills are the same size.
  2. (corollary to #1) If we resize one header or axis then all the other panes for that header or axis will resize as well. Tableau does this because it’s easier to visually parse (read) a view that has consistent sizing of elements.

Here’s a view with COUNTD(Product Names) on Text & Color with just discrete (blue) pills on Rows and Columns:

Somehow we need to fit 509 Product Names into the pane for Q4 2015/Office Supplies. If I resize Office Supplies to be taller then both Furniture & Technology change as well:

The same goes if I’ve got a continuous axis to place X/Y coordinates on. In this view I’ve simply put MIN(0) and MIN(1) on Columns & MIN(0) Rows and we can see a set of axes:

If I resize MIN(1) on Columns then to make it wider then all of the panes for MIN(0) and MIN(1) on Columns are resized.

So we can’t really dynamically resize panes to fit the data, all we can do is fit more or less into a pane. Therefore the desired solution can’t involve resizing panes, instead we will need to be generating more or fewer panes, and that leads to the next point around panes.

Green Panes vs. Blue Panes: Number of Panes

The third key element around green panes and blue panes is this:

  1. a) Continuous pills generate an axis for every discrete pill header. b) Discrete pills generate a header for every value of the pill.

We can see a) in action in the continuous views above, with MIN(0) and MIN(1) on Columns we get two axes for each quarter/year combination. So to add more axes we’d need to add more continuous pills but we can’t dynamically add them, and the number of axes ultimately depends on the discrete pills anyway so discrete is the way to go.

We can see b) in the discrete views above, there’s a header for each quarter in each year. Where this gets a little more interesting (and more useful in our case) is when the data is sparse, as in this case where the Avery products are not sold in every customer Segment:

Avery 5 is only sold in one segment so there is only a single header for Consumer, whereas Avery 494 is sold in all three segments so there’s a header for each.

So how this comes together is that in reating X/Y coordinates for positioning the text in our desired view we’re going to use discrete headers that can give us just enough headers (and no more) for the task, here’s a pic of the desired view with those headers:

Packing the Marks: the Algorithm

I experimented with some different layouts and looked at the following factors:

  • In each pane there’s a list of 0 or more values (marks).
  • At least in English when we’re reading lists we tend to make them top to bottom and when more is needed we add another column to the right.
  • There’s a balance in readability between too many columns vs. too tall columns. When there are many columns already then adding more columns for the list makes the view harder to read; in other words, a “tall” view with fewer columns is easier to read than a “wide” view.
  • When the panes in a row or panes in a column have different numbers of marks it’s important to efficiently stack the marks: too much white space can make the view harder to read.
  • A stacking layout that is closer to a differently-sized squares is easier to read than one that ends up with differently-sized rectangles.

The algorithm I came up with is a variation on the panel chart layout I used in Waffle Charts and Unit Charts on Maps that uses table calculations. The algorithm does the following:

  • Calculates the index for each mark in a pane using INDEX() and the number of marks in a pane using SIZE(). These calculations are used in the following calculations.
  • Counts the number of mark columns needed for each pane where there’s a Max # of Mark Columns. parameter to set a “no more than” value to prevent views from getting too wide. Then a nested calculation counts the maximum number of mark columns in each column.
  • Once we have the number of mark columns then the algorithm computes the number of mark rows for each pane, and then gets the maximum number of mark rows for each row.
  • Finally the mark row position and mark column position can be computed based on the index for each mark in the pane and the available number of rows and columns.

I numbered the calculations so they can be each brought into a workout view in order with their compute using set and validated before moving to the next calc. Calcs 1 & 2 require a compute using on the dimension to be used on Text and Calcs 4 & 6 have nested compute usings, see the comments on the calcs for details.

Here’s the workout view:

One complication is that the date dimensions are on Detail with custom dates with the ATTR() aggregation on Rows. This is a method to prevent unwanted data densification.

Once the workout view is built and validated then it’s possible to duplicate the view and rearrange pills, here’s that view:

There’s still a bit of manual resizing required, in this case it’s just to have enough size in each of the panes created by the column and row position table calculations to display the text. Once that is done those headers can be hidden for the final view:

We’re not limited to a text display, for example here’s a highlight table that only took a couple more clicks:

 

Conclusion

Here’s a view to play with where you can adjust the Max # of Columns parameter and the number of states (which is a proxy for how many products are displayed). Click the image to open the text wrapping in pane view on Tableau Public:
The key concept to keep in mind is that when Tableau won’t plot marks where we want we can add to the data source to get the necessary X&Y coordinates via joins, blends, and/or writing calculations. Since Tableau was designed as a tool to support interactive visual analytics tasks like making giant text tables with the desired text wrapping can take more effort than we might like, however given Tableau’s flexibility we can get the job done.

Chart Types

Chart Types

This section covers a whole bunch of chart types that are not part of Show Me, but can be built in Tableau, along with some notes on how to get existing charts to work more like I want them to. There’s also a whole section on the Path Shelf.

Be sure to check out the following sources of material on the Tableau Community:

Multiple mark types on same view:

put multiple measures on same row/column Then choose Dual Axes (synchronize if necessary) Then on the Marks card, click on the upper-right drop-down arrow to choose Multiple Mark Types

Showing Summary and Detail Together | Tableau Software
http://onlinehelp.tableausoftware.com/current/pro/online/en-us/help.htm#multiplemeasures_combocharts.html

Path Shelf

On blood transfusion data, getting a table calc to have connected points for a line chart:

Notes from Mar 2012 WebEx w/Joe Mako

I don’t want to misrepresent Joe’s awesome knowledge here, if there are any mistakes in these notes from our conversation they are almost certainly mine.
In Tableau v7.0, the Tableau DATETRUNC() from the pill menu doesn’t work. 1. Turn Quarter into Continuous field using DATE(DATETRUNC(‘quarter’,[date field])) 2. Set to Exact Date – Continuous 3. Put Month([date field]) on Path Shelf. Note – when on LoD it causes partitioning, when on Path shelf it helps connect marks 3. Then for each measure (axis) select the pill->Format->Hide…Connect Lines

Another comment on PATH shelf

Using  a set to get the path shelf to draw things properly: http://community.tableausoftware.com/message/136628#136628 From Think Data Thursday #4, 9/13/12 Path Shelf needs specific structure of data. In particular, origin/destination need to be in the same column, not separate columns. More on Path shelf From http://community.tableausoftware.com/message/188861#188861 If you’re trying to just get the data together, try these resources: http://kb.tableausoftware.com/articles/knowledgebase/using-path-shelf-pattern-analysis The key bit that is not talked about in that is that if you want to use Tableau’s built-in geocoding to get latitude and longitude, you need to change them to aggregate fields like MIN(State), this forum post has the details: http://community.tableausoftware.com/thread/109399 Finally, I’ve attached a workbook that demonstrates this. point to point mapping.twbx

Putting charts in tooltips:

http://www.tableausoftware.com/community/support/kb/barsintooltips http://www.thedatastudio.co.uk/blog/the-data-studio-blog/andy-cotgreave/charts-in-a-tooltip http://www.tableausoftware.com/about/blog/2010/09/using-bar-charts-tooltips Bullet charts: http://www.freakalytics.com/2011/01/29/enhanced-bullet-charts/ Tableau control charts: http://www.tableausoftware.com/support/knowledge-base/control-charts http://dataremixed.com/2011/10/how-to-make-control-charts-with-tableau/ http://sanpelegrino.tumblr.com/ funky pie charts: http://twitpic.com/72r2jp Treemaps http://www.cs.umd.edu/hcil/treemap/ Box plots: http://www.tableausoftware.com/support/knowledge-base/box-plot-analog

Likert scales:

http://www.datarevelations.com/likert-scales-the-final-word.htmlhttp://www.datarevelations.com/using-tableau-to-visualize-survey-data-part-1.htmlhttp://community.tableausoftware.com/thread/117982 – putting many questions all together to see the spread

More on surveys
http://peltiertech.com/WordPress/charting-survey-results/

Nice post about ordering & annotating data:
http://www.storytellingwithdata.com/2013/09/logic-in-order.html

panel or trellis charts:

http://www.thedatastudio.co.uk/blog/the-data-studio-blog/andy-cotgreave/panel-charts-in-tableau http://www.datarevelations.com/the-likert-question-question.html In Tableau, panel charts really need the X and Y axes to have the same values Joe’s version: http://community.tableausoftware.com/message/181493#181493

http://boraberan.wordpress.com/2013/03/15/trellis-charts-with-tableau-8/

Small Multiples for Tables

http://www.perceptualedge.com/articles/b-eye/tablelens.pdf

Ensuring dual axes are available

Make sure that both fields have the same datatype. One way to check to see what data type Tableau is recognizing a field as is to open the calculated field box, select the desired field and in the yellow box at the bottom right will tell what type of field it is. Note that datatype and number format are independent! See this thread on what can happen when you try mark labels on a dual axis chart without synchronized axes: http://community.tableausoftware.com/thread/114593

Parallel Coordinate Plots

http://public.tableausoftware.com/views/ParallelCoordinatesExample/ParallelCoordinatesExample http://www.tableausoftware.com/support/forum/topic/parallel-coordinates-plot http://www.perceptualedge.com/articles/b-eye/visual_multivariate_analysis.pdf http://www.perceptualedge.com/articles/b-eye/parallel_coordinates.pdf

Combination chart with overlapping bars and line:

Using measure values and unstacking marks to create the overlapping bars, dual axis to create the line. http://vizwiz.blogspot.com/2011/08/tableau-tip-7-easy-steps-to-create.html image[78] calendar view http://www.tableausoftware.com/blog/calendar-data-visualization waterfall charts http://community.tableausoftware.com/thread/107514?start=0&tstart=0 Using Custom Shapes http://community.tableausoftware.com/thread/116844 https://www.interworks.com/blogs/iwbiteam/2012/01/27/using-custom-shapes-tableau cumulative distributions (pareto chart) http://kb.tableausoftware.com/articles/knowledgebase/cumulative-distributions pareto Grouped Bar chart (like what Excel does)

See http://drawingwithnumbers.artisart.org/bars-and-lines/ for a more complete treatment of doing grouped bars and lines.
http://kb.tableausoftware.com/articles/knowledgebase/grouped-bar-chart side by side bars Joe Mako variation on this using Custom SQL that would allow for multiple lines, I think: http://community.tableausoftware.com/message/132454#132454 Also called side by side stacked bars Stem and Leaf plots http://www.datadrivenconsulting.com/2011/04/stem-and-leaf-plots-sorta-in-tableau/ stem and leaf plot Ternary charts http://community.tableausoftware.com/message/179240#179240 ternary plot making more interesting data-rich vizzes: 1.     duplicate a measure (usually as rows) 2. do multiple mark types 3. aggregate or disaggregate the measure as needed 4. turn on dual axis 5. synchronize axes examples – putting sales by customer circles on a bar chart of sales by state putting pie charts on a chloropleth map putting an overall average on a per unit average from TCC11 – JediTricks video Triangle charts http://community.tableausoftware.com/message/178976#178976 triangle plot

More than 2 mark types on same view

Joe Mako hack in Tableau 5 using reshaped data to draw lines as points, bars, and a line http://public.tableausoftware.com/views/BarLineandDot/Example Treemaps Treemaps in Tableau? can be done. Waterfall charts http://www.alansmitheepresents.org/2011/02/waterfall-and-funnel-charts.html

Kaplan-Meier Survival Curves

http://community.tableausoftware.com/message/216551#216551

 

Radial Chart

http://interworks.co.uk/tableau/radial-bar-chart/

[loop category=”wikicontent” tag=”charts,chart-types,bar-charts,Kaplan-Meier,Likert,Likert-scales,Marks-Card,panel-charts,trellis-charts,Path-Shelf,Show-Me,small-multiples,survival-curves,ternary-charts,tooltips,waterfall-charts”]
[field title] – Added [field date]
[content]
[/loop]

Related posts:

    [loop tag=”charts,chart-types,bar-charts,Kaplan-Meier,Likert,Likert-scales,Marks-Card,panel-charts,trellis-charts,Path-Shelf,Show-Me,small-multiples,survival-curves,ternary-charts,tooltips,waterfall-charts” exclude=”this” relation=”and” compare=”not” taxonomy=”category” value=”wikicontent”]

  • [field title-link][field thumbnail-link]

[/loop]