如何在Power BI Desktop中创建词云生成器

In this article, we’ll look at how to create a Word cloud generator in Power BI Desktop, including importing data, customization and more.

在本文中,我们将研究如何在Power BI Desktop中创建词云生成器,包括导入数据,自定义等等。

In my last article, Power BI Desktop Interactive chord diagrams, we learned about customized visualizations in Power BI Desktop. These visualizations are free to install and we can use them with our data set and customize charts as per our requirements.

在上一篇文章Power BI Desktop Interactive和弦图中 ,我们了解了Power BI Desktop中的自定义可视化。 这些可视化是免费安装的,我们可以将其与数据集结合使用,并根据需要自定义图表。

总览 (Overview)

A Word Cloud is a visualization that draws an image from frequently appearing words in the data set. These words are arranged in a cloud shape. The size of the words in the cloud image is proportional to its frequency.

词云是一种可视化效果,可以从数据集中经常出现的单词中绘制图像。 这些词以云的形式排列。 云图像中单词的大小与其频率成正比。

Below is an example of how Word cluster looks like (Image Courtesy – Wikipedia)

如何在Power BI Desktop中创建词云生成器

以下是Word群集外观的示例(图片由Wikipedia提供)

We can use word clusters to display keywords, tags, etc. We can quickly locate the items in the Word Cloud based on the size and color of the word.

我们可以使用词簇来显示关键字,标签等。我们可以根据词的大小和颜色在词云中快速找到项目。

For example, in the above example, we can see that the fewer words are appearing in the larger font size that shows the most used keyword as per the conditions defined.

例如,在上面的示例中,我们可以看到,按照定义的条件,以较大的字体显示的单词越少,显示出使用最多的关键字。

We can use Power BI Desktop to create an interactive visualization with control on the appearance of the word cluster on the text, size, color, number of words, background, rotation etc.

我们可以使用Power BI Desktop创建交互式可视化文件,并控制文本中字簇的外观,大小,颜色,字数,背景,旋转度等。

导入Word Cloud Generator的样本数据 (Importing Sample data for Word Cloud Generator)

To create a word cloud generator, we’ll first need data. In this example, we will use sample data books.csv from GitHub. This data shows the title, author, genre and publisher details.

要创建文字云生成器,我们首先需要数据。 在此示例中,我们将使用来自GitHub的示例数据book.csv 。 此数据显示标题,作者,类型和发行者详细信息。

如何在Power BI Desktop中创建词云生成器

Click on Raw, copy and save the data into.CSV file. We will import this.CSV file to create the Word cloud generator in Power BI Desktop.

单击Raw,将数据复制并保存到CSV文件中。 我们将导入this.CSV文件以在Power BI Desktop中创建词云生成器。

Now open Power BI Desktop and click on ‘Get Data’. Choose ‘Text\CSV’ source from the list.

现在打开Power BI Desktop,然后单击“获取数据”。 从列表中选择“文本\ CSV”源。

如何在Power BI Desktop中创建词云生成器

Provide the location of the source data (books.csv) and click Open.

提供源数据的位置(books.csv),然后点击打开

如何在Power BI Desktop中创建词云生成器

We can get a preview of the data here. If we do not want to make any changes in the data, then click on Load.

我们可以在这里预览数据。 如果我们不想对数据进行任何更改,请单击“ 加载”

In this example, some of the fields contain blank values as well. Therefore, we do not want those blank values data to create a Word Cloud generator. Click on Edit

在此示例中,某些字段也包含空白值。 因此,我们不希望这些空白值数据创建词云生成器。 点击编辑

In this example, some of the fields contain blank values as well. Therefore, we do not want those blank values data to create our Word cluster. Click on Edit

在此示例中,某些字段也包含空白值。 因此,我们不希望这些空白值数据创建Word群集。 点击编辑

如何在Power BI Desktop中创建词云生成器

In this example, some of the fields contain blank values as well. Therefore, we do not want those blank values data to create our Word cloud generator. Now click on Edit to make changes in the data.

在此示例中,某些字段也包含空白值。 因此,我们不希望这些空白值数据创建我们的词云生成器。 现在单击“ 编辑”以更改数据。

This opens Power Query Editor. Click on the columns and uncheck the blank value option from the publisher column.

这将打开Power Query Editor。 单击列,然后从发布者列中取消选中空白值选项。

如何在Power BI Desktop中创建词云生成器

Similarly, uncheck the blank value from the ‘Author’ column.

同样,取消选中“作者”列中的空白值。

如何在Power BI Desktop中创建词云生成器

Once we are done, click on ‘Close and Apply’

完成后,点击“关闭并应用”

如何在Power BI Desktop中创建词云生成器

Now, we can see the fields in our dataset in the ‘Fields’ section.

现在,我们可以在“字段”部分中查看数据集中的字段。

如何在Power BI Desktop中创建词云生成器

从Microsoft AppSource导入Word Cloud Generator (Importing from Microsoft AppSource for Word Cloud Generator)

We can get the Word cluster from the Microsoft AppSource. We can view a brief description and tutorial video clip on the page.

我们可以从Microsoft AppSource获取Word群集 我们可以在页面上查看简要说明和教程视频剪辑。

如何在Power BI Desktop中创建词云生成器

Click on ‘Get IT Now’ and click on continue to accept the terms and conditions. Please note you need to log in with a work account in order to install a Word cluster in Power BI Desktop.

单击“立即获取IT”,然后单击继续以接受条款和条件。 请注意,您需要使用工作帐户登录才能在Power BI Desktop中安装Word群集。

如何在Power BI Desktop中创建词云生成器

Click on Download for Power BI

单击下载以获取Power BI

如何在Power BI Desktop中创建词云生成器

Save the .pbiviz file into the desired location. We will use this file to import into Power BI Desktop.

将.pbiviz文件保存到所需的位置。 我们将使用此文件导入Power BI Desktop。

如何在Power BI Desktop中创建词云生成器

Now in the Power BI Desktop, Click on custom visual section From File. We get a warning message that the custom visuals are not provided by Microsoft and we should consider security or compliance risks before proceeding.

现在,在Power BI Desktop中,单击“自文件”中的自定义可视部分。 我们收到一条警告消息,即Microsoft不提供自定义图像,我们应在进行操作之前考虑安全或合规性风险。

Click on Import to move further.

单击导入以进一步移动。

如何在Power BI Desktop中创建词云生成器

如何在Power BI Desktop中创建词云生成器

Provide the path of the Power Bi visual file (.pbiwiz) downloaded earlier and click open.

提供先前下载的Power Bi可视文件(.pbiwiz)的路径,然后单击“打开”。

如何在Power BI Desktop中创建词云生成器

This imports the custom Word cluster visual and results in the following success message.

这将导入自定义Word群集视觉效果,并显示以下成功消息。

如何在Power BI Desktop中创建词云生成器

We can see below the icon for Word cluster in the visualization section of Power BI Desktop now.

现在,我们可以在Power BI Desktop的可视化部分中看到Word群集的图标。

如何在Power BI Desktop中创建词云生成器

自定义可视化 (Custom visualizations)

Before we create the Word cloud generator, let us understand the sample data further. Put a check on the Author and Publisher columns and we can see both columns data on the left-hand side.

在创建词云生成器之前,让我们进一步了解示例数据。 选中“作者”和“发布者”列,我们可以在左侧看到这两个列的数据。

如何在Power BI Desktop中创建词云生成器

Let us increase the font size of the data to view it properly. To do so, increase the font size from

让我们增加数据的字体大小以正确查看它。 为此,请从

Format > Column header > Text Size

格式>列标题>文本大小

Format > Values >Text Size

格式>值>文本大小

如何在Power BI Desktop中创建词云生成器

Data is now visible properly. Click on publisher column and select Count.

现在可以正确看到数据了。 单击发布者列,然后选择计数

如何在Power BI Desktop中创建词云生成器

This shows the count of the publisher for the authors.

这显示了作者的发布者数量。

如何在Power BI Desktop中创建词云生成器

We can sort the data here easily. Simply, click on the column name and sort it in ascending or descending order.

我们可以在这里轻松地对数据进行排序。 只需单击列名称,然后按升序或降序对其进行排序。

如何在Power BI Desktop中创建词云生成器

Now, our data looks like below and we are now ready to create a Word Cloud generator from this.

现在,我们的数据如下所示,我们现在可以从中创建词云生成器。

如何在Power BI Desktop中创建词云生成器

Click on Word Cloud Generator icon from the Visualization section and this draws a blank chart.

单击可视化部分中的词云生成器图标,这将绘制一个空白图表。

如何在Power BI Desktop中创建词云生成器

Drag the fields from the data set in the category and values section. Below we can see fields as

从类别和值部分的数据集中拖动字段。 在下面我们可以看到如下字段

Category -> Authors

类别->作者

Values -> Publishers

价值观->出版商

This draws up the Word cluster based on the data we selected.

这将根据我们选择的数据绘制Word群集。

如何在Power BI Desktop中创建词云生成器

If we click on any particular word, it shows up the details of that particular author. However, as we can see, for author John , it just looked at the first name John and combined the data together.

如果单击任何特定单词,它将显示该特定作者的详细信息。 但是,正如我们所看到的,对于作者John来说,它只是查看John的名字并将数据组合在一起。

如何在Power BI Desktop中创建词云生成器

Similarly, we can change the value to Count of the publisher from the drop-down option.

同样,我们可以从下拉选项中将值更改为“发布者的计数”。

如何在Power BI Desktop中创建词云生成器

By default, the Word cluster looks for the first word in the value section in Word Cloud Generator. It does not look the entire word as a single word. If we want to create a Word cloud generator for the complete name, go to General ->Word-breaking. By default, it is turned on. Move the slider and turn off the word breaking.

默认情况下,Word群集在Word Cloud Generator的value部分中查找第一个单词。 它不会将整个单词看成一个单词。 如果要为全名创建词云生成器,请转到常规->分词。 默认情况下,它是打开的。 移动滑块并关闭分词功能。

如何在Power BI Desktop中创建词云生成器

We can now observe the Word cluster; this is now showing the complete name of the author. If we look at our data table, Steinbeck John is having the highest count and it reflects in the Word cluster. The font size of Steinbeck John is largest in the visual.

现在我们可以观察到单词簇; 现在显示了作者的全名。 如果查看数据表,Steinbeck John的计数最高,它反映在Word群集中。 Steinbeck John的字体大小在视觉上最大。

如何在Power BI Desktop中创建词云生成器

Now if we click on it, we can see that only one row for it.

现在,如果单击它,则只能看到一行。

如何在Power BI Desktop中创建词云生成器

在Word Cloud Generator中停止单词 (Stop Words in Word Cloud Generator)

We normally use some common words, for example, a, an, the, etc. Sometimes we do not want these words to appear in the Word cluster since they are commonly used words and if our dataset contains these words, it would be difficult to get a true picture of Word cluster by showing frequently used words.

我们通常使用一些常用单词,例如a,an,the等。有时我们不希望这些单词出现在Word群集中,因为它们是常用单词,并且如果我们的数据集包含这些单词,将很难通过显示常用单词来获得单词簇的真实图片。

In the below example, we created a Word Cluster visual for ‘Title’.

在下面的示例中,我们为“标题”创建了一个Word Cluster视觉效果。

如何在Power BI Desktop中创建词云生成器

We can see above, there are a few words (the, of) appearing in the visual and we do not want to show them in this Word cluster.

我们可以在上面看到,视觉中出现了几个词(the,of),我们不想在此Word群集中显示它们。

To exclude those words, go to format -: Stop Words.

要排除这些单词,请使用格式-:停止单词。

Move the slider to turn on this feature and enable Default-Stop Words.

移动滑块以启用此功能并启用Default-Stop Words

Default stop words removed commonly used stop words from the Word Cloud Generator.

默认的停用词已从词云生成器中删除了常用的停用词。

如何在Power BI Desktop中创建词云生成器

We can see the below visual after we turned on Default-Stop Words.

启用默认停止字词后,我们可以看到以下视觉效果。

如何在Power BI Desktop中创建词云生成器

We can also specify words to exclude apart from the default stop words. For example, we want to exclude the word ‘Vol’ so specify ‘Vol’ in the words section as shown below

除了默认停用词外,我们还可以指定要排除的词。 例如,我们要排除单词“ Vol”,因此在单词部分中指定“ Vol”,如下所示

如何在Power BI Desktop中创建词云生成器

If we want to exclude multiple words, specify them with space. For example, in below visual, we excluded ‘Vol data’ keywords.

如果要排除多个单词,请用空格指定它们。 例如,在下面的视觉图中,我们排除了“体积数据”关键字。

如何在Power BI Desktop中创建词云生成器

词云生成器中的自定义 (Customization in Word Cloud Generator)

  • Rotation: we can specify the min and max angle of rotation along with Max number of rotations.

    Go to the format section and Rotate Test. Change the desired property and observe the change in the Word cluster visual

    如何在Power BI Desktop中创建词云生成器


    旋转我们可以指定最小和最大旋转角度以及最大旋转数。

    转到格式部分,然后旋转测试 。 更改所需的属性,并观察Word群集外观中的更改

    如何在Power BI Desktop中创建词云生成器


  • Title: We can set the title of the Word cluster visual from the format ->Title section. If we do not want the title, turn it off.

    如何在Power BI Desktop中创建词云生成器

    Specify the title, font colour, size, alignment and we can see that in the Word cluster visual

    标题:我们可以通过格式->“标题”部分设置Word群集外观的标题。 如果我们不想要标题,请将其关闭。

    如何在Power BI Desktop中创建词云生成器

    指定标题,字体颜色,大小,对齐方式,我们可以在Word群集视觉效果中看到

  • Background: we can change the background color of the Word cluster visual using this property. Go to Background in the format section

    如何在Power BI Desktop中创建词云生成器

    Turn it on and select the background color and transparency level

    背景:我们可以使用此属性更改Word群集视觉效果的背景颜色。 在格式部分转到背景

    如何在Power BI Desktop中创建词云生成器

    打开它并选择背景颜色和透明度

结论 (Conclusion)

Word Cloud Generator in Power BI offers an interactive method to do the analysis for frequently used words, text with customization. In this article, we reviewed how to create a Word cloud generator with Power BI Desktop. Explore these techniques with your own data sets and enjoy clouding!

Power BI中的词云生成器提供了一种交互式方法,可以对自定义的常用单词,文本进行分析。 在本文中,我们回顾了如何使用Power BI Desktop创建词云生成器。 使用自己的数据集探索这些技术,并享受乌云密布的乐趣!

目录 (Table of contents)

Power BI Desktop Interactive chord diagrams
Power BI Desktop Pulse Charts
>How to create a Word Cloud generator in Power BI Desktop
Power BI desktop Mekko Charts
Hexbin Scatterplot in Power BI Desktop
Candlestick chart for stock data analysis in Power BI Desktop
Enlighten World Flag Slicer in Power BI Desktop
Flow Map Chart in Power BI Desktop
Ask a Question feature in Power BI Desktop
Power BI Desktop Q&A data interaction examples
Power BI Desktop and Python; like Peanut Butter and Chocolate
Power BI Desktop Pie Chart Tree
Importing data from a PDF file in Power BI Desktop
Power BI Desktop交互式和弦图
Power BI桌面脉冲图
>如何在Power BI Desktop中创建词云生成器
Power BI桌面Mekko图表
Power BI Desktop中的Hexbin散点图
用于Power BI Desktop中的库存数据分析的烛台图
在Power BI桌面中启发世界国旗切片器
Power BI Desktop中的流程图
Power BI Desktop中的“提问”功能
Power BI桌面问答数据交互示例
Power BI Desktop和Python; 像花生酱和巧克力
Power BI桌面饼图树
从Power BI Desktop中的PDF文件导入数据

翻译自: https://www.sqlshack.com/how-to-create-a-word-cloud-generator-in-power-bi-desktop/