3 Replies Latest reply on Jul 14, 2015 6:22 PM by Yury Ulasenka

    Using parameters to sort stacked bars chart by any of its components.

    Yury Ulasenka



      I found this example of transforming a poor viz into a good viz by Stephen Few here: https://nces.ed.gov/programs/slds/pdf/08_F_06.pdf


      The "bad" (original) viz is called "Favorable and Unfavorable View of the U.S." and was published on the Web site for Bill Moyers’ public television show "Now":


      And here is the "good" viz proposed by Stephen Few to replace the "bad" one:


      I wanted to play with it a little, so first thing I done was transforming these three charts into one stacked bar chart. I also added bars with each country's population and a map.


      The next thing I wanted to do is make it possible for the user to sort bar chart by any of the four components ("Favorable", "Undecided or Neutral", "Unfavorable" and "Population (2014)"). First thing I added two Parameters and one Calculated Field "Rank" that ranks the measure selected on the first Parameter's Control in the order selected on the second Parameter's Control. Then I added the "Rank" Calculated field in the Rows shelf as "Discrete" and unchecked "Show Header".


      Here is the final viz that allows to sort top chart by any of the four components in one click: