This blog series, titled “AlteryxTips,” will feature helpful Alteryx tips delivered weekly by AlteryxACE AkimasaKajitani.
Alteryx’s Interactive Chart tool is a convenient tool that can create various types of graphs, but they are not perfect. For example, let’s try creating a bar graph for data with the following structure.

If you set this up as is in the Interactive Chart tool, it will create a bar graph for each prefecture, so you will probably set up Chiba Prefecture, Tokyo, and Kanagawa Prefecture as separate layers, as shown below.

The resulting graph will look like this:

Actually, here’s something to consider: let’s say there’s an unspoken understanding within the company that the graphs should be arranged in the order of Tokyo, Chiba, and Kanagawa prefectures. However, unfortunately, Interactive Chart tool doesn’t allow you to change the order of these layers. Changing the layer order usually requires recreating the chart from scratch.

However, it’s a hassle to recreate layers every time. Here, I’ll introduce a technique to change the order of layers without recreating them.
How can you change the layer order?
In such cases, it’s possible to address the issue by rewriting the XML. In a previous tip, I showed how to display the XML view and rewrite the XML. I’ll use this method again this time.
First, let’s look at it in XML view. Click the XML view button (if the XML view button is not visible, set it to appear in the options).

And then, the XML will be displayed as follows. Structurally, it is as follows:

Basically, the information for each layer is generated in the order in which the layers were created, so you just need to rearrange the order of each layer block. To rewrite the XML, use the edit button in the upper right corner.
Note that, please make sure to back up your workflow in case something goes wrong!

When you click on the edit button, the XML editor will launch, so move the entire content between the tag and the tag so that it is in the order you want.

If you rearrange the layers appropriately and press the OK button, the layer order will actually be changed.

The order of the graphs will also change accordingly.

What if the data is stored vertically?
In the case above, each item was arranged horizontally, so I created a bar graph with separate layers. However, data like this is often arranged vertically, as shown below.

When data is stored in this way, it is often represented on a single layer using a Transforms option.

In this case, you cannot change the order using XML. Basically, you need to handle it through the data’s sorting order (Interactive Chart tool does correspond to the data order and display order). I covered this in a previous Weekly Tips article, so please refer to that for more details.
Conclusion
- This article showed you how to edit XML to change the layer order when you have created multiple layers in an Interactive Chart tool.
Samle workflow Download
The next post will be…
It will be about database.

コメント