在 Power BI 中色彩格式化的秘訣和訣竅Tips and tricks for color formatting in Power BI

Power BI 提供許多不同的方式,用來自訂您的儀表板和報表。Power BI provides many different ways to customize your dashboards and reports. 本文詳細說明一系列秘訣,讓您的 Power BI 視覺效果更吸引人、更加有趣,且視您的需求自訂。This article details a collection of tips that can make your Power BI visualizations more compelling, interesting, and customized to your needs.

這裡提供下列秘訣。The following tips are provided. 有其他絕佳的秘訣嗎?Have another great tip? 太棒了!Great! 請寄給我們,我們會考慮將您的秘訣加入這個清單。Send it our way and we’ll see about adding it to this list.

  • 變更單一資料點的色彩Change the color of a single data point
  • 根據數值設定圖表的色彩Base the colors of a chart on a numeric value
  • 根據欄位值設定資料點的色彩Base the color of data points on a field value
  • 自訂色階中所使用的色彩Customize colors used in the color scale
  • 使用發散色階Use diverging color scales
  • 如何在 Power BI 中復原How to undo in Power BI

若要進行任何變更,您必須編輯報表:從 [我的工作區] 窗格選取您的 [報表] ,然後從頂端功能表區域選取 [編輯報表] ,如下圖所示。To make any changes, you must be editing a report: select your Report from the My Workspace pane, then select Edit Report from the top menu area, as shown in the following image.

當 [視覺效果] 窗格出現於 [報表] 畫布的右邊之後,您就已經準備好開始自訂了。When the Visualizations pane appears along the right side of the Report canvas, you’re ready to start customizing.

變更單一資料點的色彩Change the color of a single data point

有時候您會想要醒目顯示一個特定的資料點。Sometimes you want to highlight one particular data point. 可能是新產品上市的銷售數字,或推行新計畫之後提升的品質分數。Perhaps it’s sales figures for the launch of a new product, or increased quality scores after launching a new program. 您可以使用 Power BI 來變更其色彩,進而醒目顯示特定資料點。With Power BI, you can highlight a particular data point by changing its color.

下列的視覺效果依據生活費用,將各州排序。The following visualization ranks states in terms of cost of living.

現在假設您想要使用色彩,進而在該清單中,快速顯示華盛頓落在哪個等級。Now imagine you want to quickly show where Washington lands in that ranked list, by using color. 以下是步驟:Here are the steps:

展開 [資料色彩] 區段。Expand the Data Colors section. 下列區段隨即出現。The following appears.

將 [全部顯示] 設定為 [開啟] 。Set Show All to On. 這會顯示視覺效果中每個資料項目的色彩。This displays the colors for each data element in the visualization. 當您將滑鼠停留在資料點時,會啟用捲動,讓您可以修改任何資料點。When you hover over the data points, scrolling is enabled so you can modify any of the data points.

在此情況下,我們可以變更 [華盛頓] 為綠色。In this case, let’s change Washington to green. 我們向下捲動至 [華盛頓] ,選取其色彩方塊內的向下箭號,之後 [色彩選擇] 視窗隨即出現。We scroll down to Washington and select the down arrow inside its color box, and the color selection window appears.

選取之後,[華盛頓] 資料點是美觀的綠色,而且肯定會凸顯出來。Once selected, the Washington data point is a nice shade of green, and certainly stands out.

即使您變更了視覺效果類型,然後返回,Power BI 仍會記住您的選擇,並將 [華盛頓] 保持為綠色。Even if you change visualization types, then return, Power BI remembers your selection and keeps Washington green.

您也可以變更多個資料項目的資料點色彩。You can change the color of a data point for more than one data element, too. 在下圖中,[亞歷桑那] 為紅色,而 [華盛頓] 仍然是綠色。In the following image, Arizona is red, and Washington is still green.

有各式各樣可以用色彩變出的花樣。There are all sorts of things you can do with colors. 在下一節,我們要來看看漸層。In the next section, we take a look at gradients.

根據數值設定圖表的色彩Base the colors of a chart on a numeric value

根據欄位數值來動態設定色彩,對於圖表用途很大。Charts often benefit from dynamically setting color based on the numeric value of a field. 這樣一來,除了用於設定長條圖的尺寸之外,您還可以顯示不同的值,並在單一圖表上顯示兩個值。By doing this, you could show a different value than what’s used to for the size of a bar, and show two values on a single graph. 或者,您可以使用這個,醒目顯示超過 (或低於) 某個值的資料點 - 也許可以醒目顯示獲利率較低的區域。Or you can use this to highlight data points over (or under) a certain value – perhaps highlighting areas of low profitability.

下列章節將說明不同的方式,用來依據數值設定色彩。The following sections demonstrate different ways to base color on a numeric value.

根據值設定資料點的色彩Base the color of data points on a value

若要根據值變更色彩,請將您想要設定色彩的欄位拖曳到 [欄位] 窗格的 [色彩飽和度] 區域中。To change color based on a value, drag the field you want to base color on into the Color Saturation area in the Field pane. 在下圖中,[稅前收益] 已拖曳到 [色彩飽和度]。In the following image, Profit before tax has been dragged into Color Saturation. 如您所見,雖然 Velo 具有更高的銷售毛額 (其資料行較高),但 Amarilla 具有較高的稅前收益 (其資料行的色彩飽和度更高)。As can see that, although Velo has higher Gross Sales (its column is higher), Amarilla has a larger Profit before tax (its column has more color saturation).

自訂色階中所使用的色彩Customize the colors used in the color scale

您也可以自訂用於色階的色彩。You can customize colors used in the color scale, too. 展開 [資料色彩] ,並查看用來視覺化資料所使用的色彩漸層。Expand Data Colors and you see a gradient of colors used for visualizing your data. 根據預設,資料中的最小值會對應至最不飽和的色彩,而最大值則對應至最飽和的色彩。By default, the lowest value in your data is mapped to the least saturated color, and the highest value to the most saturated color.

色彩範圍會顯示在漸層列,其中顯示的範圍介於 最小值最大值 的色彩值之間, 最小值 的色彩在左側,而 最大值 的色彩在右側。The color range is shown in a gradient bar that displays the spectrum between Minimum and Maximum color values, with the Minimum value color on the left, and Maximum value color to the right.

若要變更色階來使用不同範圍的色彩,請選取 [最小值] 或 [最大值] 旁邊的 [色彩] 下拉式清單,然後選取色彩。To change the scale to use a different range of colors, select the color drop-down beside Minimum or Maximum, and select a color. 下圖顯示「最大值」色彩變更為黑色,且漸層列顯示介於「最小值」與「最大值」之間的新色彩頻譜。The following image shows the Maximum color changed to black, and the gradient bar shows the new color spectrum between Minimum and Maximum.

您也可以變更這些值對應至這些色彩的方式。You can also change the way the values map to these colors. 在下圖中, 最小值最大值 的色彩分別設定為橙色和綠色。In the following image, the colors for Minimum and Maximum are set to orange and green, respectively.

在第一張影像中,請注意圖表中的長條如何反映在列中的漸層;最大值為綠色,最小值為橙色,且兩者之間的每個長條顏色深淺介於綠色和橙色。In this first image, notice how the bars in the chart reflect the gradient shown in the bar; the highest value is green, the lowest is orange, and each bar between is colored with a shade of the spectrum between green and orange.

現在讓我們來看看,如果在 [最小值] 和 [最大值] 方塊中輸入數值,會發生什麼事,其中該方塊在 [最小值] 和 [最大值] 色彩選取器下方 (如下圖所示)。Now, let’s see what happens if we provide numeric values in the Minimum and Maximum value boxes, which are below the Minimum and Maximum color selectors (shown in the following image). 讓我們先把 [最小值] 設為 20,000,000,而 [最大值] 設為 20,000,000。Let’s set Minimum to 20,000,000, and set Maximum to 20,000,000.

藉由設定這些值,漸層不再套用至 最小值 以下或 最大值以上的圖表;任何超過 最大值 的長條色彩皆以綠色顯示,而任何低於 最小值 的長條皆以紅色顯示。By setting those values, gradient is no longer applied to values on the chart that are below Minimum or above Maximum; any bar with a value over Maximum value is colored green, and any bar with a value under Minimum value is colored red.

使用發散色階Use Diverging color scales

有時候您的資料可能會有自然發散色階。Sometimes your data may have a naturally diverging scale. 例如溫度範圍在冰點有自然的中心,而獲益率分數有自然的中點 (零)。For example, a temperate range has a natural center at freezing point, and a profitability score has a natural mid-point (zero).

若要使用發散色階,請滑動 [發散] 滑桿至 [開啟]。To use diverging color scales, slide the Diverging slider to On. 當 [發散] 設為開啟後,另一個色彩選取器和值的方塊隨即出現,皆稱為中心,如下圖所示。When Diverging is turned on, an additional color selector and value box, both called Center, appear, as shown in the following image.

當 [發散] 滑桿設為開啟後,您可以分別設定 [最小值] 、[最大值] 和 [中心] 的色彩。When the Diverging slider is on, you can set the colors for Minimum, Maximum and Center separately. 在下圖中, [中心] 設為 1,因此值超過 1 的列是綠色漸層,而低於 1 的長條是紅色。In the following image, Center is set to one, so bars with values above one are a gradient shade of green, and bars below one are shades of red.

如何在 Power BI 中復原How to undo in Power BI

如同許多其他 Microsoft 服務和軟體,Power BI 提供簡單的方法,用來復原您的上一個命令。Like many other Microsoft services and software, Power BI provides an easy way to undo your last command. 例如,讓我們假設您變更資料點或一系列資料點的色彩,但您不喜歡視覺效果中出現的色彩。For example, let’s say you change the color of a data point, or a series of data points, and you don’t like the color when it appears in the visualization. 您不記得之前所用的色彩了,但知道您想要回復該色彩!You don’t recall exactly which color it was before, but you know you want that color back!

若要 復原 上一個動作,或最後幾個動作,您只需要:To undo your last action, or the last few actions, all you have to do is:

  • 輸入 CTRL+ZType CTRL+Z


您有想要分享的秘訣嗎?Do you have a tip you’d like to share? 請寄給我們,我們會考慮將您的秘訣加入這裡。Please send it our way, and we’ll see about including it here.


當選取 [格式] 圖示時,Power BI Desktop 也會提供這些可用的色彩、軸和相關的自訂項目。These color, axis, and related customizations, available when the Format icon is selected, are also available in Power BI Desktop.

後續步驟Next steps

開始使用色彩格式和軸屬性Getting started with color formatting and axis properties