Kibana 简明教程

Kibana - Working With Charts

Let us explore and understand the most commonly used charts in visualization.

  1. Horizontal Bar Chart

  2. Vertical Bar Chart

  3. Pie Chart

The following are the steps to be followed to create above visualization. Let us start with Horizontal Bar.

Horizontal Bar Chart

Open Kibana and click Visualize tab on left side as shown below −

horizontal bar chart

Click the + button to create a new visualization −

kibana visualization

Click the Horizontal Bar listed above. You will have to make a selection of the index you want to visualize.

horizontal bar list

Select the countriesdata-28.12.2018 index as shown above. On selecting the index, it displays a screen as shown below −

selecting index

It shows a default count. Now, let us plot a horizontal graph where we can see the data of top 10 country wise populations.

For this purpose, we need to select what we want on the Y and X axis. Hence, select the Bucket and Metric Aggregation −

horizontal graph

Now, if you click on Y-Axis, it will display the screen as shown below −

click y axis

Now, select the Aggregation that you want from the options shown here −

aggregation options

Note that here we will select the Max aggregation as we want to display data as per the max population available.

Next we have to select the field whose max value is required. In the index countriesdata-28.12.2018, we have only 2 numbers field – area and population.

Since we want the max population, we select the Population field as shown below −

max population

By this, we are done with the Y-axis. The output that we get for Y-axis is as shown below −

y axis output

Now let us select the X-axis as shown below −

select x axis

If you select X-Axis, you will get the following output −

x axis output

选择按词条聚合。

choose aggregation terms

从下拉菜单中选择字段。我们想要按照国家获取人口,所以选择国家字段。我们有以下排序选项:

dropdown field

我们将按最大人口排序,因为我们希望人口最多的国家优先显示。添加了所需数据后,单击指标数据顶部所示的应用更改按钮,如下所示:

highest population

一旦你单击应用更改,我们将获得一个水平图形,其中我们可以看到中国是人口最多的国家,其次是印度、美国等。

horizontal graph china

类似地,你可以通过选择所需的字段来绘制不同的图形。接下来,我们将此可视化效果保存为 max_population,以便以后用于创建仪表板。

在下一部分,我们将创建垂直条形图。

Vertical Bar Chart

单击可视化选项卡,并使用垂直条形图和索引 countriesdata-28.12.2018 创建一个新的可视化效果。

在此垂直条形图可视化效果中,我们将创建以国家地区为维度的条形图,即按照区域面积从大到小对国家进行展示。

因此,让我们选择 Y 和 X 轴,如下所示:

Y-axis

vertical bar chart

X-axis

vertical bar chart x axis

当我们在这里应用更改时,我们可以看到如下所示的输出:

vertical bar chart output

从图形中,我们可以看到俄罗斯拥有最大的面积,其次是加拿大和美国。请注意,此数据是从国家数据索引中提取的,并且是虚拟数据,因此数字可能与实时数据不符。

让我们将此可视化效果保存为 countrywise_maxarea,以便以后与仪表板一起使用。

接下来,让我们研究饼图。

Pie Chart

因此,首先创建一个可视化效果,然后选择索引为国家数据的饼图。我们要在饼图格式中显示国家数据中可用区域的数量。

左侧具有提供数量的指标。在存储区中,有 2 个选项:拆分切片和拆分图表。现在,我们将使用拆分切片选项。

pie chart visualization

现在,如果你选择拆分切片,它将显示以下选项:

pie chart buckets

选择按词条聚合,它将显示更多选项,输入如下所示:

aggregation terms

字段下拉菜单将包含从所选索引中的所有字段。我们选择了区域字段,并将其排序方式选为计数。我们将按降序排序,大小设置为 10。因此,这里我们将获得国家索引的 10 个区域数量。

现在,单击如下所示的高亮显示的播放按钮,你应该会在右侧看到更新后的饼图。

pie chart updated

Pie chart display

pie chart displayed

所有区域均在右上角以颜色列出,并会在饼状图中显示相同颜色。将鼠标悬停在饼状图上,它将提供区域的数量及区域的名称,如下所示 −

pie chart mouse over
pie chart region

由此,我们可以了解到 Sub-Saharan Afri 占 22.77% 的区域所上传的国家数据。

从饼状图中,观察可知亚洲区域占 12.5%,数量为 28。

现在我们可以单击右上角的保存按钮保存可视化,如下所示 −

asia region

现在,保存可视化以供以后在控制面板中使用。

visualization dashboard