依旧是学习大神Toan Hoang的作品,点象限图,原链接如下:
Dot Quadrant Chart in Tableau - Toan Hoang
我目前的工作中还没有用到这个图的机会,不过可以学习以下做法,举一反三,尝试不同的变种。
数据
Metric,Path,Percentage
Metric 1,1,0.8
Metric 1,100,0.8
Metric 2,1,0.9
Metric 2,100,0.9
Metric 3,1,0.4
Metric 3,100,0.4
Metric 4,1,0.7
Metric 4,100,0.7
注意:每个数据有两条记录,两条的区别在于Path不同。
计算字段
把数据导入Tableau Desktop之后,创建如下计算字段。
Path (Bin)
右击Path,选择 Create Bins,按下图配置
Index
INDEX()
TC_Percentage
WINDOW_MAX(MAX([Percentage]))
Rows
IF [Index] = 1 THEN
1
ELSEIF [Index] <= 4 THEN
2
ELSEIF [Index] <= 9 THEN
3
ELSEIF [Index] <= 16 THEN
4
ELSEIF [Index] <= 25 THEN
5
ELSEIF [Index] <= 36 THEN
6
ELSEIF [Index] <= 49 THEN
7
ELSEIF [Index] <= 64 THEN
8
ELSEIF [Index] <= 81 THEN
9
ELSE
10
END
Columns
IF [Rows] = 1 THEN
0
ELSEIF [Rows] = 2 THEN
[Index] - 3
ELSEIF [Rows] = 3 THEN
[Index] - 7
ELSEIF [Rows] = 4 THEN
[Index] - 13
ELSEIF [Rows] = 5 THEN
[Index] - 21
ELSEIF [Rows] = 6 THEN
[Index] - 31
ELSEIF [Rows] = 7 THEN
[Index] - 43
ELSEIF [Rows] = 8 THEN
[Index] - 57
ELSEIF [Rows] = 9 THEN
[Index] - 73
ELSEIF [Rows] = 10 THEN
[Index] - 91
END
注意:我们用Rows和Columns来组成等边三角形。
Color
IF [Index] / WINDOW_MAX([Index]) <= [TC_Percentage] THEN
WINDOW_MAX(MAX([Metric]))
ELSE
"Grey"
END
X
IF WINDOW_MAX(MAX([Metric])) = "Metric 1" THEN
[Columns]
ELSEIF WINDOW_MAX(MAX([Metric])) = "Metric 2" THEN
[Rows]
ELSEIF WINDOW_MAX(MAX([Metric])) = "Metric 3" THEN
[Columns]
ELSE
-[Rows]
END
Y
IF WINDOW_MAX(MAX([Metric])) = "Metric 1" THEN
[Rows]
ELSEIF WINDOW_MAX(MAX([Metric])) = "Metric 2" THEN
[Columns]
ELSEIF WINDOW_MAX(MAX([Metric])) = "Metric 3" THEN
-[Rows]
ELSE
-[Columns]
END
工作表
下面我们来制作工作表
-> 把标记类型(Mark Type) 设置为Circle
-> 把Path (Bin) 拖到Columns,右击确定选中Show Missing Value,然后再把它拖到Detail Mark
-> 把Metric拖到列
-> 把Rows 拖到行,右击Rows,点击Compute Using,选择Path (Bin)
-> 把Columns 拖到列,右击Columns,点击Compute Using,选择Path (Bin)
-> 把Color拖到Color Mark,右击,点击Compute Using,选择Path (Bin)
如果一切顺利的话,我们可以得到下图。可以看到每个三角形都是由100个圆点组成的等边三角形。
接下来我们要利用X和Y来旋转这些三角形。
-> 把X 拖到列,替换原来的Columns,右击,点击Compute Using,选择Path (Bin)
-> 把Y 拖到行,替换原来的Rows,右击,点击Compute Using,选择Path (Bin)
然后我们可以得到下图:
接下来把Metric从列上拖到Detail Mark,作品马上快完成了。
最后,我们调整一下格式:
-> 隐藏 Axis Headers.
-> 隐藏网格线 Grid Lines.
-> 隐藏列分隔 Column Dividers.
-> 隐藏行分割 Row Dividers.
-> 隐藏基准线 Zero Line.
-> 修改颜色.
-> 修改提示信息 Tooltip.
Boom! 成品来了!
最后附上大神的话,我同样也很喜欢。
I hope you all enjoyed this article as much as I enjoyed writing it and as always do share the love.