WeeklyAlteryxTips#89 Considerations regarding the arrangement of items within a pie chart.

Alteryx

This blog series, titled “AlteryxTips,” will feature helpful Alteryx tips delivered weekly by AlteryxACE AkimasaKajitani.

This time, the topic is again about Alteryx’s interactive charts.

About Pie Charts in Interactive Charts

Interactive Charts include a feature for creating pie charts. Let’s start by creating one. I’ll use a simple dataset for this example.

Configure the settings as follows.

  • Type : Pie
  • Values : amount
  • Labels : category_major_cd

This produces a pie chart like the one shown below.

Does anything about it feel slightly off? The slices may not be arranged as you expected. Normally, you might expect them to be positioned clockwise from largest to smallest, but what order is this chart actually using?

Display Order of Pie Charts in Interactive Charts

The pie chart layer settings include an option called “Pie Segments,” where you can configure the Order setting.

“Sorted” is enabled by default, but what criterion does it actually use?

If you turn sorting off, the slices can be displayed in the same order as the data.

Really? The data was arranged as shown below, in sequence from 04 through 09.

Looking closely at the chart, the first value, “04,” appears in the upper-right. For some reason, “05” is in the upper-left, followed farther around by “06.” In other words, the slices are arranged as shown below.

When I realized this, I felt completely deflated… I just wish it would arrange them clockwise in a straightforward way…

So, when sorting is enabled, the largest slice is placed in the upper-right, and the remaining slices are arranged counterclockwise in descending order.

This is confusing, so how can I arrange the slices in the order I expect—that is, clockwise from largest to smallest?

Arrange the Slices Clockwise from Largest to Smallest

The sorting feature forces the slices to be placed counterclockwise from the upper-right, so turn sorting off.

Then adjust the order of the data. The procedure is as follows.

  1. Sort the data in ascending order.
  2. From the data in step 1, create a dataset containing only the last row.
  3. From the data in step 1, exclude the last row.
  4. Union the datasets from steps 2 and 3, in that order.

This produces the data shown below.

In other words, place the largest value in the first row, then arrange the remaining data in ascending order. The Sampling tool does not have a function for excluding only the last row, so using CReW Macro’s “Skip Last N” makes this easy.

The workflow is shown below.

This produces the pie chart shown below.

Conclusion

  • I clarified the seemingly mysterious display order of pie chart data in the Interactive Chart tool.
  • I explained a workflow for displaying pie chart slices clockwise from largest to smallest.

Sample Workflow Download

The next blog post is…

The next blog post will be about Formulra tool’s UI.

コメント

Copied title and URL