1. There is an amazing Viz of the day on 12/20/2016 showing the mortality rate change in USA on certain diseases. Excellently designed!
    There are over 3142 counties on each of the 6 maps.  I would like to view some of the counties in details. So I added a mechanism to close in. This can be the basis for anyone who wants to add further functionalities.

    The steps to do it are:
    - drag all the 6 heat maps into a floating vertical container
    - create a separate filled map for counties
    - add another floating vertical container on top of the above one and drag the filled map to it
    - create a button to close the pop-up map.
    - create one action filter for pop-up view and another for going back to the original view.

    Click the image below to see it in action or download the workbook.
    The resulting viz got some small issues. I hope someone can enlighten me:

    1.Currently we need to click twice to close the popup map and go back to the original view. I wish I need to click the button (at the top right corner) only once. Maybe we need some action filter wizardry. Anyone can help?

    2.In the popup map, if the view is changed, +/- 'ed, then the next time we click on a county in the heat map, the view won't be focused. Need to reset the view to focus.

    In the process, I found that 3 counties can't be found in the map. The county names are new while the map data is from 2010. I had to do the following matching:

    Petersburg Borough -> Petersburg
    Kusilvak Census Area -> Wade Hampton
    Sainte Genevieve County -> Ste Genevieve

    0

    Add a comment

  2. Cross Join is also called Cartesian Join. It's named after the great French philosopher and mathematician René Descartes. The original spelling of his family name is in two words: Des Cartes, therefore Cartesian. Among many great inventions, he is well known for saying: I think therefore I am (Je pense donc je suis).
    Cross Join is quite useful in data manipulation in creating Sigmoid/Spline based charts (Sankey for example), data scaffolding and many other applications.

    Some may wonder why Tableau doesn't offer Cross Join within its join interface. I guess that it's because there are so many ways we can do it already. Here let me summarize them here.

    1.Via Custom SQL with Union
    Assume we want to cross join two tables: A and B. This works when one of the 2 tables is smaller with just a few rows (and a few columns). Assume here B has only 2 rows and 1 column:
    Let's open Table A (Orders table in Superstore data set) in Excel file via Legacy Connection. This gives us the option to write Custom SQL.
    This creates the cross join between the two tables! This is an application in creating Sigmoid curve.

    If B has more rows, we just need to add more such unions. If B has more columns, we need to explicitly spell them out for each and every element of the columns in the query.

    As we mentioned before, this approach is good if B is small.

    2.Via Custom SQL with Excel
    Once I needed to create a table structure via cross join for scaffolding. Then I put the tables into separate sheets in one Excel file. Opening it via legacy connection and using Custom SQL, I am able to cross join them easily.

    Select * from [Date$],[Product Category$],[Customer Segment$]

    This approach is fairly universal and only needs a single line of SQL code.

    3.Via Tableau's Native Inner Join Dialog
    Zen Master Jeffrey Shaffer described this cross join approach early on. Kettan wrote a great tutorial by creating an extra identical Join Key column in each joining table. The Join Key column can be populated with the same number such as 1 or the same string such as 'Join'.

    4.Via Tableau Join Calculation (Tableau 10.2+) (See updates in comments)
    This approach doesn't need SQL nor pre-populated Join Key column. No need to reshape data. This can work across different data sources. It's the most versatile approach.

    In Tableau 10.2+, we can use "Join Calculation" to create Join Keys in both joining tables. Here we created '1' column in both tables. Note that only the first Join Key can be 1, while the other has to be generated using a formula. The dialog just doesn't let me to enter 1 in both Join Calculations. No need of pre-populated Join Key any more.
    I was told by Zen Master Chris Love that Bethany Lyons of Tableau demoed something similar at Tableau Conference 2016. After viewing the video, I found that she used Join Calculation in one table, and pre-populated the other table with a Join Key column. It works as well.

    Voila, a little review of the four approaches for Cross Join in Tableau. Pick the one that's appropriate for you. Let me know if you have different approaches.
    2

    View comments

  3. Zen Master Chris Love wrote a Sankey chart tutorial which is quite popular. Actually the Sigmoid-based Sankey chart was first introduced to the Tableau world by another Zen Master Jeffrey Shaffer. I am a recent convert of Sigmoid curve and love it. Check my recent post on creating Sigmoid with 2 rows of data.

    Just found that the creation of a Sankey chart can be made a bit easier, mainly in the data prep stage. Let me use his same example and streamline the procedure a little bit.

    I will describe 2 options here. One is for all recent Tableau versions. The other is for 10.2 or above, which doesn't need any SQL script.

    For recent Tableau versions

    1.Load the Superstore data set into Tableau via Legacy Connection.
    2.Create this Custom SQL:
    This will create the data set necessary. Here [Point] is equivalent to [ToPad] in Chris' example. Those rows are for respectively point 1 and point 49 in the curve. Then we can proceed to create [Padded] bins and trigger data densification upon it.

    For Tableau 10.2+

    1.Load the Superstore data set into Tableau
    2.In the data source editor, add another 1-column x 2-row table  as follows (in Excel)
    3.Join them as follows
    This takes advantage of the new "Join Calculation" feature in 10.2 to create join conditions. The 1=1 condition results in a cross join between the superstore data and the above 2-row table. We get thus the data set we need for creating Sankey or any Sigmoid based charts.
    This method doesn't need SQL script.

    4. BTW, Sigmoid expression can be written a bit more concise:
    Sigmoid(t) = 1/(1+EXP(-t))

    Voila, I created a little Sankey chart similar to the example of Chris.
    Click the above image to access the interactive version.

    0

    Add a comment

  4. In the current #MakeoverMonday project of the week 50, Ben Jones created a very nice viz. I like the layout in general. But I feel the map is hard to use as state index. As we know, on a natural map, the smaller states or countries get penalized visually.
    Since all we need is an index to the states, a tiled map is a good choice which is fair to all the states. Even a linear list of states would suffice. The tiled map is just a bit fancier with a hint of geographical location.

    A dotted map could be another solution to the problem. But here we go with the tiled map which has larger buttons.
    A few additional tweaks are:
    - Showing ranks when highlighted
    - Using dimension highlighter for states. One more index to find the state of interest. It's also my first time to use this new feature in Tableau 10.

    Click the image to go to the workbook.
    0

    Add a comment

  5. Following previous post on Creating Sigmoid with 2 Rows of Data which is inspired by Rody Zakovich's post, I was looking for some interesting curves to apply the same trick. Then I fell on this one:
    http://www.tableau.com/stories/gallery/theta-analysis
    This viz is created by the technical product marketing people at Tableau. The trochoids are defined here which belong to a family of math functions.

    The twbx file weighs over 12MB and there are 880K+ rows in the data set. Looks like a good case for me to try. The result is pretty good. To create the same chart, I only needed 2 rows of data in a single column. The workbook size is reduced to 118K, that is, less than 1% of the original size.

    The key for the data reduction is the use of data densification.
    Click image to view the interactive version.

    Some details of the implementation are as follows.

    1.The two rows of data are in a single column:
    2.I created "gear ratio" and "cycloidality ratio" as parameters, instead of dimensions. This saves quite a few rows
    3.Used Padded and Index() to create data densification as did in the previous post.

    4.Created 5 calculated fields for the coordinates:
    That's the tweak of the week.
    0

    Add a comment

  6. Sigmoid function can provide a smooth curve connecting two points in space. We have seen it in a number of graphical representations such as Sankey chart or this one.

    Given any two points, a Sigmoid curve can be drawn between the two. As a result, all we need are two rows of data which define the two points in space. Below will lay out the steps to create a Sigmoid curve. And we will also re-create the chart that Jeffrey Shaffer has done with a table of over 2000 rows of data. This creation is inspired by Rody Zakovich's recent post. Rody also has been creating Sigmoid curves using two rows. Joe Mako, Chris Love and Alan Eldridge have done great work on creating curved line by data densification. I am just building on their prior work.

    What is a Sigmoid function?

    Its math function is written as

    y(x)=1/(1+exp(-x)) or y(x)=1/(1+e^(-x))

    The drawing of this function is as follows (Curve=y)
    Using the Sigmoid curve for connecting two dots could be a better visual representation than just a straight line.

    Implementation in Tableau

    In our example to show the ranking change from 2012 to 2013, we need two rows data as follows
    Then we need to define the number of points we need to draw the Sigmoid as smooth as it can be. Let's pick 49 as the number. Here the first point is at 2012, and the 49th is at 2013.
    Another property of the Sigmoid curve is the range of horizontal coordinates. Let's define it to be from -6 to +6.

    We will need to create the following calculated fields:
    - Index = Index()
    - X = 0.25*Index-6.25 (This maps the 49 points from index to horizontal coordinates.)
    - Sigmoid = 1/(1+EXP(-X))
    - Curve = [2012 Rank]+Sigmoid*([2013 Rank]-[2012 Rank])
    Curve is the Y coordinate.
    Next, let's create bins (Padded) based on Point. This will help us create the extra 47 points we need for drawing the Sigmoid curve, through data densification.
    To trigger the densification, we need to first drag Padded to the rows and right click it. Then select Show Missing Values. We can see that the two rows are becoming 49 rows.
    After, drag Padded to the Details shelf. Drag Index to the Details as well. Make it compute using Padded.

    Drag X to Columns and Curve to Rows, and set them to compute along Padded. Now we will get our beautiful Sigmoid curve!
    On the above, we showed all the 49 points in the curve. Selecting the following option in Color, we can remove the dots and get a smooth curve.

    Voila that is how we can draw a Sigmoid curve using two rows.

    Included in the attached workbook, we provided an example of comparing the 2012-2013 rankings for 50 US states, which is the same data set used by Jeffrey Shaffer.

    In this particular example, we have to reverse the vertical axis so that the smaller ranks are on top.

    We only need 2 rows of data per state and there are a total of 100 rows of data for 50 states. Here is a screenshot of the final dashboard, colored by the change scale in rankings.
    Also included is a parametric Sigmoid. User can define the number of points and the range of the horizontal coordinates.

    Feel free to download the workbook and play with it.

    2

    View comments

  7. This is a sequel to my recent post: #TweakThursday 22: Ordering By Narrative. That one is focusing on dashboard tweaking. Here I would give details on ways of boosting a stacked area chart.

    Stacked area chart is visually attractive in displaying multiple members' values evolving along another dimension, such as time series.

    There may be various ways of coloring the stacked area chart. But I found that using gradient shades of the same color makes the chart highly attractive.

    On the other hand, stacked area chart is vertically challenged because we can't compare easily along the vertical dimension. The contrast is not as sharp as in bar chart. We will add a bar chart in tooltips to boost the vertical comparison.

    The example here is based on a viz by Andy Cotgreave and a recent Viz of the Day, results of the #MakeoverMonday.

    1. Coloring the chart
    The main steps include:
    - Using gradient (discrete) shades of the same color
    - Darker to lighter from bottom to top
    - Highlighting one member using a different color if needed

    Please refer to this article on highlighting one member among others in gradient shades of the same color. The highlighting can be made dynamic via a parameter.

    2. Tooltip design
    In the bar chart in tooltips, I would like to highlight the data mark I am hovering opon in a different color. I thus need 3 sets of new fields/variables. For a given dimension member, only one of the blue bar and the orange bar is lighted up at anytime.

    The creation of the following variables can be made easier by a technique here. The bar chart in tooltips is described here.

    Blue bars for the data marks when they are not hovered upon. Note that a window function has to be used to get the values of non-hovered data marks.
    - Orange bars for the data marks when they are hovered upon.
    - Labels for the orange bars. Only one label will show at anytime.
    The code for the tooltips are as follows:
    The resulting tooltip is as follows:

    That's how we can make a boosted stacked area chart. This technique can apply to stacked bar chart or any chart where you want to enhance the contrast in some dimension.

    The workbook can be accessed here to view the tooltips in action.
    1

    View comments

  8. [A sequel to this post: Boosting Stacked Area Chart]

    I wrote a post called Ordering By Context before. In a recent Viz of The Day on 11/29/2016, I found that, a conspicuous narrative at the top of the chart, is labeled as "Bottom 90%".
    It's like, the narrative says something at right, but the object is placed at left.

    Placing the "Bottom 90%" at the top is not consistent with the narrative. So, I decided to move it to the bottom, which is one of the tweaks of the day.
    Another tweak is that I added a bar chart in the tooltips.

    Note that stacked area chart is always a visual feast. However, its insufficiency, is that, it's hard to compare vertically. Or it is vertically challenged. Having a bar chart in tooltips can help mend it up.
    The part I really like is the highlight of the "Bottom 90%" in a different color, in the same manner as one approach I mentioned before.

    While researching on this viz, I found that this viz is built on top of a viz created by Andy Cotgreave, which is part of the #MakeoverMonday Week 48 project. (Andy is one of the duos that are behind the #MakeoverMonday movement. What an amazing project! ) I just hope that Andy Cotgreave's credit is acknowledged in some way.

    The interactive workbook can be accessed here.


    0

    Add a comment

  9. A few days ago, the viz of the day on 11/22/2016 shows the bike usage in Philadelphia. Very nicely designed with a combination of route map, top 10 routes per bike station and daily usage heat maps.

    The little things I would like to tweak are as follows. The main idea here is to create consistency across different views, so that we can compare things under the equal conditions or relate one view with another easily.

    1. Keeping the map view consistent

    The map view may vary greatly when clicking on the top 10 route bars.
    The single dot means it is a round trip where starting and ending stations are the same one.
    To fix this, go to desktop menu: Map > Map Options. Just change the map option from "Automatic" to either "Metric" or "U.S.". The other map options don't seem very useful in this viz. They can be turned off or left alone.
    Now we can set the map view to be a fixed city map, where we can see the relative location of the routes.

    2.Keeping the line size consistent

    The route line width is sized according to the usage. The size range changes according to the starting bike station. Personally I feel that using a global size range will allow us to compare the bike usage between different routes regardless of starting points.

    This is how I chose to use a fixed size range:
    There are a few usage numbers larger than 1000. So the largest size is for usage >=1000
    3.Keeping the color palette consistent

    This is an effort to create a common palette between the top 10 routes bar chart and route map. This allows us to easily identify the same route across the two charts. Note that the data ranges are different in these two charts. To force a common palette, we need to use a fixed lower bound. The upper bound is always the same.


    Other tweaks include:

    4.Showing dots at both starting and ending bike stations

    It's a line chart option to add a dot at a data point.
    5.Highlighting routes using action filter

    This allows us to view the top 10 routes quickly by hovering mouse over the bar chart.

    This concludes the tweaks of this viz. It's intended to share some of my design ideas. See you next time.

    The tweaked version can be accessed from here.
    0

    Add a comment

  10. [Had a great Tableau Conference in Austin Texas last week! Met great people. Learned a bunch. Now back to work.]

    A dashboard on French election has won the viz of the day on 11/16/2016. It is quite simple but rich in information. It shows quite well the social media usage and the main topics of interest in their campaigns by the front runners.

    I found some places in the viz that I may want to tweak. But the workbook was not downloadable. I asked the author Jade Le Van for the workbook and she gracefully enabled it for download.

    In the original design, one can click on the bar chart and view the tweeting frequency along the time axis by each candidate. However the bar chart is shrunken to make room for the tweeting frequency view.

    The design is based on a flat 2-D canvas. Then when the frequency chart expands, the bar chart got shrunken and become hard to read. The consistency of the bar chart is lost.
    Actually, we can design the dashboard in a 3-D space. That is, we can create layers of charts floating on top of each other, so that we are not constrained by a 2-D canvas. The floating charts show up only when evoked. Otherwise, they remain transparent and unintrusive to the viewers at all. The canvas is 3-D where we can float charts over charts. So, the canvas is flat only when we think it is flat. It can have a new dimension if we change our thought.

    In my tweak, I added two floating charts, or precisely two floating (vertical) containers. The containers become transparent if their content is null.

    1.Floating container for the frequency chart
    - First, let's float a vertical container at the top of the existing dashboard. Then drag the "Fréquence des Tweets" chart (as a tiled object) and drop it into the container.

    - Then set up the same action filter with the options "Select" and "Exclude all values when clearing all the selections". When clicking on a bar, the corresponding frequency chart will show up on top.
    2.Floating container for the tweet list
    In the original circles chart, each circle represents a tweet. The text of each tweet is shown in the tooltip. However, there are too many circles overlapping each other. My tweak is as follows:
    - Each circle will represent the tweets of a day. The size of the circle equals the number of tweets on that day.
    - Create a sheet listing all the tweets.
    - Float a vertical container and drag the tweet list sheet into it (as a tiled object)
    - Set up an action filter that will pop up the corresponding tweets when clicking on a circle.
    - Set up a URL action that will go to the tweet page when clicking a tweet.


    This completes my tweak of the day. To access the workbook, click the above picture.

    In conclusion, we can use floating charts for drilldown or for alternative views. Instead of a flat canvas, we can float charts over each other to design interactive dashboards that meet our imagination. Thanks for the feedback on the design by Jade Le Van.
    2

    View comments

Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.