举个栗子!Tableau 技巧(278):创建霓虹条形图(Neo

很多数据粉在分析音乐、电影或时尚媒体等数据时,喜欢用霓虹效果的 Icon 点亮分析看板。
如果分析图表也能实现类似的呈现,岂不更好?试试看,先来创建一个霓虹条形图~

如何在 Tableau 中具体实现呢?今天的栗子,一睹为快吧!
本期《举个栗子》,我们要给大家分享的 Tableau 技巧是:创建霓虹条形图(Neon Bar Charts)。
为方便学习,栗子使用如下的两个文本数据源。掌握栗子方法后,数据粉可尝试使用其他数据源。

具体步骤如下:
1
连接数据源
打开 Tableau Desktop,连接文本数据源“绘制霓虹条形图.txt”。进入数据源页面,将第二个数据源的文本复制粘贴(Ctrl+V)到视图右侧。
使用内部联接来创建关联数据源,通过自定义计算设置表的关联条件为:1。

2
创建数据桶和计算字段
新建工作表,先来创建两个数据桶:
➤ 数据桶:Path (bin),大小设为10

➤ 数据桶:Position (bin),大小设为0.01

接着,创建五个计算字段:
➤ 计算字段:TC_Value,键入函数
WINDOW_MAX(MAX([Value]))

➤ 计算字段:Index,键入函数
IF INDEX() <= [TC_Value] THEN
INDEX()
ELSE
NULL
END

➤ 计算字段:Index Columns,键入函数
INDEX()-1

➤ 计算字段:TC_Position,键入函数
WINDOW_MAX(MAX([Position]))

➤ 计算字段:Columns,键入函数
[Index Columns]

3
创建视图
将“标记”卡的标记类型改为:密度。
将数据桶“Path (bin)”和“Position (bin)”拖放至列,分别右键单击这两个胶囊,下拉菜单都勾选:显示缺失值。然后,将它们拖放至“标记”卡的详细信息中。
将字段“Bar”和“Columns”拖放至列,右键单击列上的“Columns”胶囊,下拉菜单选择:计算依据选择-Position (bin)。

将字段“Index”拖放至行,右键单击该胶囊,下拉菜单选择:计算依据-Path (bin)。

再次右键单击行上的“Index”胶囊,下拉菜单选择:编辑表计算。在弹窗中,将嵌套计算选为:TC_Value,特定维度选择:Path (bin) 和 Position (bin)。

4
设置格式
单击图表右下方的“>10k个null”,弹窗中选择:筛选数据。

隐藏标题和标签,将网格线等都设为:无。将视图设置为:整个视图。

最后,将工作表背景设为黑色。单击“标记”卡的大小,按需设置条形的粗细。
如此,就完成我们想要的霓虹条形图咯~

本期的 Tableau 技巧,你 Get 到了吗?
下一期,再见~

文章部分信息来源于网络,如有侵权请告知