Tableau 简明教程

Tableau - Bar Chart

条形图以矩形条表示数据,条的长度与变量值的比例相同。当您将维度拖到行架并测量到列架时,Tableau 会自动生成条形图。我们还可以在“显示方式”按钮中使用条形图选项。如果数据不适合条形图,则该选项将自动变为灰色。

A bar chart represents data in rectangular bars with the length of the bar proportional to the value of the variable. Tableau automatically produces a bar chart when you drag a dimension to the Row shelf and measure to the Column shelf. We can also use the bar chart option present in the Show Me button. If the data is not appropriate for bar chart, then this option will be automatically greyed out.

在 Tableau 中,可以使用维度和度量创建多种类型的条形图。

In Tableau, various types of bar charts can be created by using a dimension and a measure.

Simple Bar Chart

从示例超级商店中,选择维度,将利润拖到列架,并将子类别拖到行架。它会自动生成一个水平条形图,如以下屏幕截图所示。如果没有,您可以从“显示方式”工具中选择图表类型以获得以下结果。

From the Sample-Superstore, choose the dimension, take profit to the columns shelf and Sub-Category to the rows shelf. It automatically produces a horizontal bar chart as shown in the following screenshot. In case, it does not, you can choose the chart type from the Show Me tool to get the following result.

barchart 1

Bar Chart with Color Range

您可以根据条形图的范围对其应用颜色。条形图越长,色调越深;条形图越短,色调越浅。为此,将利润字段拖到“标记”窗格下的调色板。还要注意,它会为负条形图生成不同的颜色。

You can apply colors to the bars based on their ranges. The longer bars get darker shades and the smaller bars get the lighter shades. To do this, drag the profit field to the color palette under the Marks Pane. Also note that, it produces a different color for negative bars.

barchart 2

Stacked Bar Chart

您可以在上述条形图中添加另一个维度以生成堆叠条形图,在每个条中显示不同的颜色。将名为细分维度的字段拖到“标记”窗格并将其放入颜色中。将显示以下图表,其中显示了每个条形图中每个细分的分布。

You can add another dimension to the above bar chart to produce a stacked bar chart, which shows different colors in each bar. Drag the dimension field named segment to the Marks pane and drop it in colors. The following chart appears which shows the distribution of each segment in each bar.

barchart 4