Power BI 中的着色地图(等值线图)Filled maps (choropleths) in Power BI

备注

可以在 Power BI Desktop 和 Power BI 服务中创建并查看这些视觉对象。These visuals can be created and viewed in both Power BI Desktop and the Power BI service. 本文中的步骤和图示来自 Power BI Desktop。The steps and illustrations in this article are from Power BI Desktop.

着色地图使用明暗度、颜色或图案来显示不同地理位置或区域之间的值在比例上有何不同。A filled map uses shading or tinting or patterns to display how a value differs in proportion across a geography or region. 使用从浅(不太频繁/较低)到深(较频繁/较多)的明暗度快速显示这些相对差异。Quickly display these relative differences with shading that ranges from light (less-frequent/lower) to dark (more-frequent/more).

美国地图

发动到必应的数据What is sent to Bing

Power BI 与必应相集成,提供默认地图坐标(一个称为地理编码的过程)。Power BI integrates with Bing to provide default map coordinates (a process called geo-coding). 在 Power BI 服务或 Power BI Desktop 中创建地图可视化效果时,“位置” 、“纬度” 和“经度” 存储桶中的数据(用于创建该可视化效果)将发送到必应。When you create a map visualization in Power BI service or Power BI Desktop, the data in the Location, Latitude, and Longitude buckets (that is being used to create that visualization) is sent to Bing.

你或管理员可能需要更新防火墙,以允许访问必应用来地理编码的 URL。You, or your administrator, may need to update your firewall to allow access to the URLs Bing uses for geocoding. 这些 URL 是:Those URLs are:

有关发送到必应的数据的详细信息,以及提高地理编码成功率的提示,请参阅地图可视化效果的提示和技巧For more information about the data being sent to Bing, and for tips to increase your geo-coding success, see Tips and tricks for map visualizations.

何时使用着色地图When to use a filled map

着色地图适用情况:Filled maps are a great choice:

  • 要在地图上显示定量信息。to display quantitative information on a map.
  • 要显示空间模式和关系。to show spatial patterns and relationships.
  • 你的数据已进行标准化处理。when your data is standardized.
  • 处理社会经济数据时。when working with socioeconomic data.
  • 当定义的区域很重要时。when defined regions are important.
  • 要获取跨地理位置的分布的概况。to get an overview of the distribution across the geographic locations.

先决条件Prerequisites

本教程使用零售分析示例 PBIX 文件This tutorial uses the Retail Analysis sample PBIX file.

  1. 在菜单栏的左上部分,选择“文件” > “打开” From the upper left section of the menu bar, select File > Open

  2. 查找零售分析示例 PBIX 文件的副本Find your copy of the Retail Analysis sample PBIX file

  3. 在报表视图中打开零售分析示例 PBIX 文件 报表视图屏幕截图图标Open the Retail Analysis sample PBIX file in report view Screenshot of the report view icon..

  4. 选择Select 黄色选项卡的屏幕截图。 ,以添加新报表页。to add a new page.

创建基本的着色地图Create a basic filled map

在此视频中,Kim 将创建基本地图并将其转换为着色地图。In this video, Kim creates a basic map and converts it to a filled map.

备注

此视频使用较低版本的 Power BI Desktop。This video uses an earlier version of Power BI Desktop.

创建着色地图Create a filled map

  1. 从“字段”窗格中,选择“地区” >“状态” 字段。From the Fields pane, select the Geo > State field.

    “状态”旁的黄色复选标记

  2. 将图表转换为着色地图。Convert the chart to a filled map. 请注意,州 现在位于位置 框中。Notice that State is now in the Location well. 必应地图使用位置 框中的字段创建地图。Bing Maps uses the field in the Location well to create the map. 该位置可以是各种有效位置:国家/地区、州、县、市、邮政编码或其他邮政编码等。必应地图可提供世界各地的着色地图形状。The location can be a variety of valid locations: countries, states, counties, cities, zip codes or other postal codes etc. Bing Maps provides filled map shapes for locations around the world. 如果“位置”框中没有有效的条目,则 Power BI 无法创建着色地图。Without a valid entry in the Location well, Power BI cannot create the filled map.

    突出显示着色地图图标的模板

  3. 筛选地图使其只显示美国大陆。Filter the map to display only the continental United States.

    a.a. 在“可视化效果”窗格左侧,找到“筛选器” 窗格。To the left of the Visualizations pane, look for the Filters pane. 如果该窗格已最小化,则展开它Expand it if it is minimized

    b.b. 将鼠标悬停在“状态” 上方,然后选择 v 形展开图标Hover over State and select the expand chevron
    显示“状态(全部)”的视觉对象级别筛选器Visual level filters showing State(All)

    c.c. 在“全部” 旁边添加复选标记,并删除 AK 旁边的复选标记。Place a check mark next to All and remove the check mark next to AK.

    未选中“全部”和“AK”的“状态”下拉列表

  4. 选择“油漆滚刷”图标,打开“格式设置”窗格,然后选择“数据颜色” 。Select the paint roller icon to open the Formatting pane, and choose Data colors.

    显示数据颜色选项的格式设置窗格

  5. 单击三个竖直点,再择“条件格式设置”选项 。Select the three vertical dots and choose Conditional formatting.

    数据颜色条件格式设置按钮

  6. 通过“默认颜色 - 数据颜色”屏幕决定将如何设置着色地图的阴影 。Use the Default color - Data colors screen to determine how your filled map will be shaded. 可供使用的选项,其中包含阴影设置字段和阴影应用方式。The options available to you include which field to base the shading, and how to apply the shading. 在本例中,我们使用的是“SalesFact > 情绪”字段,并将情绪的最小值设为红色,将最大值设为绿色 。In this example we're using the field SalesFact > Sentiment, and setting the lowest value for sentiment as red and the highest value as green. 介于最小值和最大值之间的值将显示绿色和红色阴影。Values that fall between the maximum and minimum will be shades of red and green. 屏幕底部的图解显示了将要使用的颜色范围。The illustration at the bottom of the screen shows the range of colors that will be used.

    选定了情绪的默认颜色窗格

  7. 着色地图为绿色和红色,其中红色代表较低的消费意愿数值,绿色代表较高、较积极的消费意愿。The filled map is shaded in green and red, with red representing the lower sentiment numbers and green representing the higher, more-positive sentiment. 要显示其他详细信息,还请将字段拖动到工具提示。To display additional detail, drag a field into the Tooltips well. 我在此处添加了“情绪落差”,还突出显示了爱达荷州 (ID),我发现情绪落差较低,其值为 6 。Here I've added Sentiment gap and highlighted the state of Idaho (ID) and see that sentiment gap is low, at 6. 显示爱达荷州的着色地图工具提示filled map showing Idaho tooltips

  8. 保存报表Save the report.

Power BI 让你能够充分控制着色地图的外观。请随意使用这些数据颜色控件,直到获得所需的外观。Power BI gives you plenty of control over the appearance of your filled map.Play around with these data color controls until you get the look you want.

突出显示和交叉筛选Highlighting and cross-filtering

有关使用筛选器窗格的信息,请参阅向报表添加筛选器For information about using the Filters pane, see Add a filter to a report.

突出显示着色地图中的某个位置可交叉筛选报表页上的其他可视化效果,反之亦然。Highlighting a location in a filled Map cross-filters the other visualizations on the report page... and vice versa.

  1. 要继续操作,请先选择 “文件”>“保存”以保存此报表。To follow along, first save this report by selecting File > Save.

  2. 使用 CTRL-C 复制着色地图。Copy the filled map using CTRL-C.

  3. 从报表画布的底部,选择 “情绪”选项卡以打开“情绪”报表页面。From the bottom of the report canvas, select the Sentiment tab to open the Sentiment report page.

    选中的“情绪”选项卡

  4. 移动页面上的可视化效果并调整大小以腾出一些空间,然后按 CTRL-V 粘贴上一报表中的着色地图。Move and resize the visualizations on the page to make some room, then CTRL-V paste the filled map from the previous report. (请查看以下图像)(See the following images)

    已添加到“情绪”页面的着色地图

  5. 在着色地图中选择一个州。On the filled map, select a state. 这样可以交叉突出显示并交叉筛选页面上的其他可视化效果。This cross-highlights and cross-filters the other visualizations on the page. 例如,选择 “德克萨斯州”后,显示“情绪”为 75,并且德克萨斯州位于中区 #23。Selecting Texas, for example, shows me that Sentiment is 75 and that Texas is in the Central District #23.
    已选择德克萨斯州Texas selected

  6. 在“VanArsdel - 人气(按月份)”折线图上选择一个数据点。Select a data point on the VanArsdel - Sentiment by Month line chart. 这会筛选着色地图,以显示 VanArsdel 的情绪数据,而不是他们的竞争对手。This filters the filled map to show Sentiment data for VanArsdel and not their competition.
    新的底纹

注意事项和疑难解答Considerations and troubleshooting

地图数据可以是模棱两可的。Map data can be ambiguous. 例如,可以有法国的巴黎,但也可以有德克萨斯州的巴黎。For example, there's a Paris, France, but there's also a Paris, Texas. 地理数据可能存储在单独的列中 – 城市名称的列、州或省名称的列,等等 — 因此必应可能无法区分巴黎是哪个巴黎。Your geographic data is probably stored in separate columns – a column for city names, a column for state or province names, etc. – so Bing may not be able to tell which Paris is which. 如果数据集已经包含纬度和经度数据,那么 Power BI 可以提供特殊的字段使地图数据不再模棱两可。If your dataset already contains latitude and longitude data, Power BI has special fields to help make the map data unambiguous. 只需将包含纬度数据的字段拖放到“可视化效果”>“纬度”区域。Just drag the field that contains your latitude data into the Visualizations > Latitude area. 对经度数据执行相同操作。And do the same for your longitude data.

“可视化效果”和“字段”窗格

如果你具有编辑 Power BI Desktop 中的数据集的权限,则观看该视频有助于解决地图数据的模糊性。If you have permissions to edit the dataset in Power BI Desktop, watch this video for help addressing map ambiguity.

如果无法访问纬度和经度数据,但确实可以对数据集进行编辑,则按照这些说明来更新数据集If you do not have access to latitude and longitude data, but you do have edit access to the dataset, follow these instructions to update your dataset.

有关地图可视化效果的更多帮助,请参阅 Tips and tricks for map visualizations(地图可视化效果的提示和技巧)For more help with Map visualizations, see Tips and tricks for map visualizations.

后续步骤Next steps

形状映射Shape map

Power BI 中的可视化效果类型Visualization types in Power BI