Tableau单列着色(二)

Tableau每一列根据不同的规则或者针对单列设置颜色的解决方法

Create an integer calculated field called Placeholder with value zero (0)

创建一个名为Placeholder的计算字段并将值设为0

image

Drag placeholder field twice to column shelf after your dimension. It’ll create multiple marks in your view. First mark is for displaying measure values and second mark will create header title for your measure.

将Placeholder字段拖放到列功能区的维度后,拖动两次。它会在视图中创建多个标记。第一个标记用于显示度量值,第二个标记将为您的度量创建标题。

image

Now select first mark and drag your measure on label. Change the mark type from automatic to Text. You’ll get below view

现在选择第一个标记(即第一个Placeholder的标记设置),并拖动度量到Text标记上。将标记类型从自动更改为文本。如下图所示

image

Now we need to do some formatting in our view to get the desire output. Edit the first axis and delete the Title from General tab. Then go to Tick Marks and select major and minor tick marks as none

然后需要在视图中进行一些格式化以获得我们所需的结果。编辑第一个轴,在General选项卡中删除标题。然后转到刻度线中,将主要刻度线与次要刻度线均设置为无

image
image

Now select the second axis and change the mark type as polygon then right click on axis and use dual axis and synchronize to combine both axes.

然后选择第二个轴,将标记类型更改为polygon,然后右键单击Placeholder标记卡,并同步双轴。

image

After dual axis

同步轴后的样子如下

image

Drag the divider to little bit up to align the headers

向上拖动一点使标题对齐

image

Right click on your view and format. Hide the grid and zero lines

打开格式的设置窗口,隐藏网格线与零值线

image

Final view will look like this

最终效果如下

image

Repeat all the steps for creating other measure (% Difference). Only catch is drag your custom field (% Difference Color) on color marks and assign the colors as per your requirement.

重复所有步骤创建其他度量(% Difference)。然后拖动颜色标记上的自定义字段(% Difference Color)到颜色中。

image

来源:

Tableau Community Forums

https://community.tableau.com/people/mahfooj.khan/blog

问题解决