Chat Icon
Login-icon
Create a World Population Report Using a Map
Create a World Population Report Using a Map

Create a World Population Report Using a Map

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.

As a first step, launch the Bold Reports On-Premise server demo site, referring to the steps to create a report, and create a new report.

Report Designer in on-premises server
Report Designer in on-premises server

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:

  1. In the data panel, click New Data.

    Data connection panel
    Data connection panel
  2. Choose the SQL connection type.

    Supported connection types
    Supported connection types
  3. 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.

    New data source connection panel
    New data source connection panel
  4. 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.

    Query mode
    Query mode
  5. 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

  1. Find the map report item under the Data Regions category in the item panel.

    Map report item listed in item panel
    Map report item listed in item panel
  2. 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.

    Add map report item to design surface
    Add map report item to design surface

Bind 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:

  1. In the Properties panel, under the Basic Settings category, choose the data set for the DataSet property.

    Assign data set
    Assign data set
  2. Then click on the edit icon for the Binding Data property under Basic Settings.

    Edit panel icon
    Edit panel icon
  3. 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.

    BindingField Pairs editor panel
    BindingField Pairs editor panel
  4. 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.

    Bind analytical and spatial data
    Bind analytical and shape data
  5. Click on the Update.

    Binding data items count
    Binding data items count

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.

Name

In the Name property, you can provide a unique name for specific map report items.

Set name for map
Set name for map

Appearance

Under the Appearance category, set the border width and color properties for the map.

Set border for map
Set border for map

Title

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.

Set title for map
Set title for map

Legend

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.

Set legend for map
Set legend for map

Shape settings

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.

Configure shape settings for map
Configure shape settings for map

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.

  1. Choose the Sum(Population) in Data Value.
  2. Choose Color Range as the Type
  3. 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.
  4. Choose Equal Distribution for Distribution type. This type specifies ranges that divide that data so that each range has an equal number of items.
  5. 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.
Configure color settings for map
Configure color settings for map

Now, the colors are applied to the map shapes. The report design will look like the following.

Design view showcases world map
Design view showcases world map

Preview report

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.

Preview of report showcases population of United States
Preview of report showcases population of United States

Conclusion

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!

Stay tuned to our official Twitter, Facebook, LinkedIn, Pinterest, and Instagram pages for announcements about upcoming releases.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *