A map is a data visualization report item that can be used to present analytical data with a geographical background. It helps to visualize factors such as population density, election results, sales, weather, and popularity of social networking sites. From version 2.2.28, the Bold Reports Designer provides a map report item feature.
In this blog post, we will see how you can create a map report to display the population of each country and group countries with population ranges to produce a display similar to a heat map. To design and visualize the data in a map, first we must embed the required data in the Bold Reports Designer. Later, we will bind and customize the data in the map report items to showcase the population data.
Create data set
To design this report, we are going to build the query by transforming the JSON data into rows and columns using SQL Query:
- In the data panel, click New Data.
- Choose the SQL connection type.
- As I said earlier, we are going to create a data set by transforming JSON data. So, you can provide credentials and connect with any of your server databases.
- In the query builder, switch to the query mode. Refer to this link and write the SQL query to transform the JSON data into rows and columns.
- Now, click Finish.
Note: The population data we used here is an approximate measure. The live population data may vary from this.
Add map to the report design
- Find the map report item under the Data Regions category in the item panel.
- Drag a map report item onto the design surface and resize it according to your layout. By default, map will render with World Map data.
To display analytical data on the map surface, first we need to link the analytical and shape data. The shape data is the map itself, whereas the analytical data is the data set we created. The analytical data provides meaning to the shape data. To bind analytical and shape data, follow these steps:
- In the Properties panel, under the Basic Settings category, choose the data set for the DataSet property.
- Then click on the edit icon for the Binding Data property under Basic Settings.
- Now, you will be taken to the Binding Field Pairs panel. Click on the ADD icon in the top-right corner. Field Name is a shape field and the Binding expression is an analytical field.
- Here, I want to match the map surface with the country name. So, let’s choose admin in the Field Name drop-down and choose the =Fields!Country.Value expression in Binding Expression.
- Click on the Update.
Customize map appearance
Let’s customize the map name, title, legend, color settings, and other properties. These properties are listed in the properties panel, and we shall customize them one by one.
In the Name property, you can provide a unique name for specific map report items.
Under the Appearance category, set the border width and color properties for the map.
The map title is displayed at the top of the map surface. In the Properties panel, under the Title category, we can set the title text, position, and font properties for the map title. First, enable the Enable Title check box. Then, add the title and position. I have provided the title World Population and positioned it on the Left.
Legends provide valuable information for interpreting maps. Under the Legend category in the Properties panel, enable the Enable Legend check box. Here, we can set the background color, title, and position of the legend. I have provided the title Range and positioned it at BottomCenter.
Each region in a map surface is called a map shape. We can set a label, tooltip, border, and background color for it. First, we’re going to configure a value for a tooltip. Set the following expression in the tooltip property.
=Fields!Country.Value & " : " & FormatNumber(Fields!Population.Value,0)
This will display the country name and the population of each country in the tooltip when previewing the report. Next, we change the border color and width for shapes.
Shape color rule
The color rule properties can be used to define color options for each shape on the map surface. In this report design, I am going to group the countries by their population range to produce a display like a heat map. For that, first I enable the Enable Color Rule check box under the Shape color rule category.
- Choose the Sum(Population) in Data Value.
- Choose Color Range as the Type.
- We can set the start, middle, and end colors. Set the color codes #CFF09E, #79BD9B, #1074AD, respectively. The start color applies to the low end of the data range and the end color applies to data at the high end of the data range.
- Choose Equal Distribution for Distribution type. This type specifies ranges that divide that data so that each range has an equal number of items.
- The bucket count property is used to split the available data into a required number of ranges. Here, I am specifying the Bucket Count as 25. Notice the legend splits into 25 ranges.
Now, the colors are applied to the map shapes. The report design will look like the following.
You can preview the report at design time using the built-in Bold Reports Viewer to ensure the report design is as expected. Switch to the preview mode to see the country name and population when you hover on each shape of the map surface. In the following snapshot, we can observe that the color distribution is applied based on the population range of countries.
I hope this blog provides a clear overview on how to configure data and customize the appearance of the map report item in the Bold Report Designer. You can download this report design from World Population Report
If you have any questions, please post them in the comments section below. You can also contact us by submitting your question through our contact page or, if you already have an account, you can log in to submit your support question. Feel free to check out the Bold Reports Embedded demos and our documentation to explore the tools and their various report customization features.
Bold Reports now comes with a 15-day free trial with no credit card information required. We welcome you to start a free trial and experience Bold Reports for yourself. Give it a try and let us know what you think!