power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

power bi可视化表

In the article, Candlestick chart for stock data analysis in Power BI Desktop, we explored Power BI Desktop to analyze stock prices. If you follow the stock market, you might have noticed a ticker (similar to the following image) showcasing stock prices and changes since the last close price. It shows an up and down indicator depending upon the positive or negative change in the stock price.

在文章用于在Power BI Desktop中进行股票数据分析的烛台图表中 ,我们探索了Power BI Desktop来分析股票价格。 如果您跟随股票市场,可能会注意到一个股票代码(类似于下图)显示了股票价格和自上次收盘价以来的变化。 它会根据股票价格的正或负变化显示上下指标。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Recently while following the stock prices, I thought if we could create a similar stock ticket using Power BI. Let’s explore the solution in this article.

最近,在跟踪股价时,我想我们是否可以使用Power BI创建类似的股票票证。 让我们探讨本文中的解决方案。

样本数据–从PDF文件加载数据
(Sample data – Load data from a PDF file
)

For this article, I will use the sample data in a PDF file. This data is for reference purposes only and does not contain the actual figure of the stock prices.

对于本文,我将在PDF文件中使用示例数据。 该数据仅供参考,不包含股票价格的实际数字。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

The first step to create a report is to import this data. Click on Get Data -> PDF.

创建报告的第一步是导入此数据。 单击获取数据-> PDF。

You can refer to Importing data from a PDF file in Power BI Desktop article to learn how to import data from a PDF file. If you use the latest Power BI Desktop version, you do not require enabling feature from the preview features. PDF data import is in general availability now.

您可以参考Power BI Desktop中的从PDF文件导入数据以了解如何从PDF文件导入数据。 如果使用最新的Power BI Desktop版本,则不需要预览功能中的启用功能。 PDF数据导入现已全面上市。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Click on Connect, browse to the directory, and provide the PDF file path. It connects to a PDF file and fetches the stocks table, as shown below. You might get multiple tables depending upon the PDF file data. You should preview it first and load appropriate data.

单击“ 连接” ,浏览到目录,然后提供PDF文件路径。 它将连接到PDF文件并获取stocks表,如下所示。 您可能会获得多个表,具体取决于PDF文件数据。 您应该先预览它并加载适当的数据。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

We require some changes in the data, so click on Transform Data. It opens Power Query Editor to customize data.

我们需要对数据进行一些更改,因此请单击“ 转换数据”。 它会打开Power Query Editor来自定义数据。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

We require to remove suffix .NS from data in symbol column. For this requirement, right-click on the Symbol column and choose Split Column -> by delimiter.

我们需要从符号列的数据中删除后缀.NS 。 为此,请右键单击“符号”列,然后选择“ 分隔符->通过定界符”

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Specify split condition in the delimiter window and click OK. We can split the symbols using the dot (.) symbol. Here we have only one occurrence for the dot character, so it does not matter we select Left-most delimiter or Right-most delimiter.

在定界符窗口中指定分割条件,然后单击确定。 我们可以使用点(。)符号分割符号。 在这里,点字符只出现一次,因此选择“最左定界符”或“最右定界符”都没关系。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

It splits the data and creates a new column for spit text, as shown below.

它将分割数据并为吐出文本创建一个新列,如下所示。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Remove the unwanted column (in this case Symbol.2) and rename Symbol.1 column to Symbol

删除不需要的列(在本例中为Symbol.2),然后将Symbol.1列重命名为Symbol

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Save the changes, and we have data ready for visualization.

保存更改,我们准备好数据以进行可视化。

在Power BI中创建股票行情视觉 (Create a Stock ticker visual in Power BI)

We need to import a custom visual Scroller for this. Click on Import from MarketPlace, as shown below. It might ask to login from a business account in case you are not signed in already.

为此,我们需要导入自定义视觉滚动器。 单击从MarketPlace导入,如下所示。 如果您尚未登录,它可能会要求从企业帐户登录。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Here search for the Scroller visual and click the Add button to add it into the visualizations pane.

在这里搜索Scroller视觉效果,然后单击“ 添加”按钮以将其添加到可视化窗格中。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Once added, you can see the Scroller icon at the bottom of the Visualizations pane.

添加后,您可以在“ 可视化”窗格的底部看到“ 滚动器”图标。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Click on the Scroller icon and adjust the size of it.

单击滚动器图标并调整其大小。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

We need to define values for the following columns for this visual.

为此,我们需要为以下各列定义值。

  • Category: It is the category that we wish to display in the visual. For my data, it is the stock symbol

    类别 :这是我们希望在视觉上显示的类别。 对于我的数据,这是股票代码
  • Measure Absolute: It is the absolute value that we wish to display. It is the close price of the stock

    绝对测量:这是我们希望显示的绝对值。 这是股票的收盘价
  • Measure Deviation: Any change to the stock price ( positive or negative) is the measure deviation from the final(closed) price ( Measure Absolute value)

    度量偏差:股票价格的任何变化(正或负)是与最终(收盘价)的度量偏差(度量绝对值)

Let’s drag the column Symbol in the Category field and Last price in the Measure Absolute column, as shown below.

让我们将“类别”字段中的“符号”列和“绝对度量值”列中的“最后价格”拖动出来,如下所示。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

It shows stocks symbol and their prices in the stock ticker. Currently, it does not show any color codes and indicators (symbol for decrease or decrease price).

它在股票行情指示器中显示股票代码及其价格。 当前,它不显示任何颜色代码和指示符(降价或降价的符号)。

Now, drag the column Change to the Measure deviation, and it starts showing the indictor for the stock prices.

现在,将“更改”列拖动到“度量偏差”,它开始显示股票价格的指标。

  • Green up indicator: in case the stock prices increased from the closed price

    绿色向上指示器:如果股价从收盘价上涨
  • Red down indicator: in case the stock prices decreased from the closed price

    红色下降指示器:如果股价从收盘价下跌

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Once we move the cursor over the scroller, it stops scrolling. It is helpful to stop the scroller at a specific stock. As soon as we remove the cursor, it starts scrolling again.

一旦将光标移到滚动条上,它就会停止滚动。 将滚动条停在特定位置会很有帮助。 一旦我们删除光标,它就会再次开始滚动。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Power BI Desktop的Scroller可视化中的格式 (Formatting in the Scroller visual of Power BI Desktop)

We have various formatting options available in the Stock ticker of Power BI. Click on the visual and navigate to the Format section.

Power BI的“股票行情自动收录器”中提供了多种格式选项。 单击视觉,然后导航到“格式”部分。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

Let’s look at a few useful formatting options:

让我们看一些有用的格式化选项:

自动大小字体 (Auto-size font)

By default, this property is turned off. If we change the scroller’s visual size, it does not change the font size. Let’s turn it on and change the window size. In the following gif, we can look that as soon as we change the visual size, it changes the font size automatically.

默认情况下,此属性是关闭的。 如果我们更改滚动条的外观大小,则不会更改字体大小。 让我们打开它并更改窗口大小。 在下面的gif文件中,我们可以看到,只要更改视觉尺寸,它就会自动更改字体大小。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

字体大小 (Font size)

We may not enable auto-size property for stock ticker text and give a static font size to visualize better. In this case, we can specify the font size, and it changes the font sizes. Here, if we change the visual window size also, it does not change the font size.

我们可能不会为股票行情自动收录器文本启用自动调整大小属性,而是提供静态字体大小以更好地显示。 在这种情况下,我们可以指定字体大小,并更改字体大小。 在这里,如果我们也更改可视窗口的大小,则它不会更改字体大小。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

状态指示灯 (Status indicator)

If we do not want the status indicator, we can turn it off. By default, it is turned on.

如果我们不希望状态指示器,可以将其关闭。 默认情况下,它是打开的。

状态指示灯颜色 (Status indicator coloring)

As shown earlier, an indicator shows green and red color based on the stock price movement. If we do not want indicator color-coding, we can turn this property off. We can see this configuration behavior in the following image.

如前所示,指示器根据股票价格走势显示绿色和红色。 如果我们不希望指示器使用颜色编码,则可以关闭此属性。 我们可以在下图中看到此配置行为。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

状态文字着色 (Status text coloring)

By default, the scroller visual in Power BI Desktop shows stock color in white font irrespective of stock price movement. Once we turned on Status text coloring, it changes the stocks font in green or red color as per stock price movement.

默认情况下,Power BI Desktop中的滚动条视觉效果以白色字体显示股票颜色,而与股票价格变动无关。 一旦我们启用状态文本着色 ,它就会根据股票价格的变化将股票字体更改为绿色或红色。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

滚动速度 (Scroll speed)

We can change the text scroll speed as well. By default, it has a scroll speed of 1.2. Changing the scroll speed increases or decreases text scroll speed. In the following image, we can see different scrolls’ speed.

我们也可以更改文本滚动速度。 默认情况下,其滚动速度为1.2。 更改滚动速度可提高或降低文本滚动速度。 在下图中,我们可以看到不同的滚动速度。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

背景颜色 (Background color)

As shown above, the scroller has a black background. Although it works in most cases, we can still configure it as per our requirement. In this image, we see a few background colors. We can anytime revert to a default configuration using revert to default option shown here.

如上所示,滚动条具有黑色背景。 尽管它在大多数情况下都可以使用,但是我们仍然可以根据需要进行配置。 在此图像中,我们看到了一些背景色。 我们可以随时使用此处显示的还原为默认选项还原为默认配置。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

更新间隔 (Update interval)

Suppose we are doing a live feed of the stock prices from a web data source. In this case, we may want to refresh the stock prices at regular intervals. We can specify the update interval using this configuration.

假设我们正在从Web数据源实时获取股票价格。 在这种情况下,我们可能希望定期刷新股票价格。 我们可以使用此配置指定更新间隔。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

自订文字 (Custom Text)

We can specify text in the Custom Text box. Once we specify a text, it overrides the data set that we wish to visualize, for example, stock ticker. It adds additional usage of the stock ticker that you can use it to display some scrolling text in the Power BI report. You can highlight important messages for the users, such as report unavailability or refresh timings. Here, I added a text to say thanks to SQLShack and community members for my Autor of the year award.

我们可以在“自定义文本”框中指定文本。 一旦指定了文本,它将覆盖我们希望可视化的数据集,例如股票行情指示器。 它增加了股票行情自动收录器的其他用法,您可以使用它在Power BI报表中显示一些滚动文本。 您可以为用户突出显示重要消息,例如报告不可用或刷新时间。 在这里,我添加了一段文字表示感谢SQLShack和社区成员的“年度最佳汽车”奖。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

标题 (Title)

By default, the scroller adds a title as per the columns selected from the data set. Certainly, we do not want the default title in the report. We can use the title section in the format area to turn on/off title, change title font, font color, font size, alignment.

默认情况下,滚动条会根据从数据集中选择的列添加标题。 当然,我们不希望报告中包含默认标题。 我们可以使用格式区域中的标题部分来打开/关闭标题,更改标题字体,字体颜色,字体大小,对齐方式。

power bi可视化表_滚动器可视化功能,用于Power BI Desktop中的股价变动

结论 (Conclusion)

In this article, we explored the scroller visual in Power BI desktop to create a stock ticker along with a price change indicator. Similarly, we can use it for text scroller as well. It provides various formatting and customization options to make it suitable as per your requirement.

在本文中,我们探索了Power BI桌面中的滚动器视觉效果,以创建股票报价器以及价格变动指标。 同样,我们也可以将其用于文本滚动器。 它提供了各种格式和自定义选项,以使其适合您的要求。

翻译自: https://www.sqlshack.com/scroller-visual-for-stock-price-movements-in-power-bi-desktop/

power bi可视化表