ActiveReports 18 .NET Edition
Report Authors: Designer Components / Design Reports / Design Page/RDLX Reports / Tutorials: Report Controls in Page/RDLX Reports / Map Data Region in Reports
In This Topic
    Map Data Region in Reports
    In This Topic

    You can create a Page report that contains a map using the ActiveReports Map control. The Map data region shows your data on a geographical background. This walkthrough illustrates how to create a report that uses a Map to display data.

    The final report will be as shown.

    Customers Population Report with Map control at Preview 

    Create a Report

    In the ActiveReports Designer, create a new Page report. 

    Bind Report to Data

    As you create a new report, you can configure the report data connection in the Report Wizard. You can also access the Report Data Source dialog by right-clicking the Data Sources node in the Report Explorer and then selecting the Add Data Source option. See SQLite for details.   

    1. On the Choose Data Source Type screen of the wizard, select SQLite and click Next.
    2. To specify the DataBase Path, click the Browse button and navigate to the desired file on your system. For example, you can connect to the Reels.db sample data source which can be downloaded from GitHub.
    3. Click Test Connection to test the connection.
    4. Then click the Next option and configure the dataset by adding a valid query.
    5. Enter Customers into the Name and an SQL query like the following into the text box:
      Dataset Query
      Copy Code
      SELECT Address.Region, Customer.CustomerID FROM (Address INNER JOIN Person ON Address.[AddressID] = Person.[AddressID]) INNER JOIN Customer ON Person.[PersonID] = Customer.[PersonID];
      
    6. Click Next to proceed to the final screen of the Report Wizard.
    7. Review the summary of the report and click Finish to successfully add the report with the SQLite data source.

    Design Report

    1. Drag and drop the Map data region on the design area.
    2. In the Select a Map Template wizard that appears, select the USA Map template.
    3. Click the Map to have the map panes appear.
    4. In the layers pane, right-click PolygonLayer1 and select Layer Data to open Map Layer Data Properties dialog.
    5. In the Map Layer Data Properties dialog that appears, go to the Analytical data page.
    6. Select Customers from the Dataset property combo box and then click the Add (+) button located next to the Match label. This creates an empty match item and enables its Spatial and Analytical fields editor.
      Note: It is necessary to set match fields if you want to use a spatial data field from analytical data, or if you want to visualize analytical data on the map layer. Match fields enable the report processor to build a relationship between the analytical data and the spatial data.
    7. In the Spatial field property, select STATE_ABBR from the combo box; and similarly, select =Fields!Region.Value in the Analytical field property. This builds the match field expression and relates the analytical data to map elements on a polygon layer.
    8. Click OK to close the dialog.
      Configure the appearance of the Map 
    9. In the layers pane, right-click PolygonLayer1 and select Edit to open Map Polygon Layer dialog.
    10. In the General page of the dialog, select #STATE_NAME from the Label Text combo box to display as a label inside polygons at run time.
    11. Go to the Color Rule page of the dialog, and select Visualize data by using color palette option. This activates the tabs below.
    12. On the General tab, enter the following expression =Count([CustomerID]) in the Data field property and set Palette property to SemiTransparent.
    13. On the Distribution tab, set the Method property to EqualInterval.
    14. On the Legends tab, click to select Show in legend.
    15. In Legend name, select 'Legend'. This name relates to the default legend that appears in the Legend collection.
    16. Click OK to close the dialog.
    17. On the design surface, click the Map control to select it and go to the Properties Panel to set the following properties:
      • BackgroundColor: White
      • BackgroundGradientEndColor: White
      • BorderStyle: Solid
      • ColorScale > Hidden: True
      • DistanceScale > Hidden: True
      • Size: 6.5in, 4.75in
      • ViewPort > BackgroundColor: LightSteelBlue
      • ViewPort > BackgroundGradientEndColor: White
      • ViewPort > BorderStyle: None
      • ViewPort > CoordinateSystem: Planar
      • ViewPort > Meridians > Hidden: True
      • ViewPort > Parallels > Hidden: True
      • ViewPort > View > Zoom: 115
    18. With the Map control selected, go to the Properties window, click the Legends (Collection) property and then click the ellipsis button that appears.
    19. In the LegendDesigner Collection Editor that appears, under the Members list, select the existing legend and set the following properties.
      • BackgroundColor: LightSteelBlue
      • BackgroundGradientEndColor: White
      • Location > DockOutsideViewport: False
      • Location > DockPosition: RightBottom
      • Title > (Caption): Number of Customers
    20. Click OK to close the dialog.
    21. With the Map control selected, go to the Properties window, click the Titles (Collection) property and then click the ellipsis button that appears.
    22. In the MapTitleDesigner Collection Editor that appears, with Title selected in the Members list set the following properties.
      • (Text): Customers Population
      • Color: Black
    23. Click OK to close the dialog.
    24. Preview the report. 
    See Also