Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Collapse]Map Control
   [Collapse]Getting Started
     Lesson 1 - Connect to the Images Provider
     Lesson 2 - Load a Vector Cartesian Map
     Lesson 3 - Add Analytical Data to a Geographical Map
    Layers
   [Expand]Coordinate Systems
   [Expand]Map Image Data
   [Expand]GIS Data
   [Expand]Vector Data
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]End-User Features
   [Expand]Product Information
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Lesson 3 - Add Analytical Data to a Geographical Map

The Map control can visualize data bound to geographical coordinates from various data sources (a database, an XML file, a list of records, etc.). This tutorial describes the steps required to create Pie charts on the map surface using data stored in an external XML file. This XML data file contains Olympic Games medal information.

To bind a map control to an XML data source, follow the instructions below:

Expanded Step 1. Add a Map Control

Expanded Step 2. Prepare a Vector Items Layer and Load Data

  • Add an empty VectorItemsLayer to the Map's MapControl.Layers collection as follows:

  • To bind a data source to this layer, run the Data Source Wizard, as shown in the following image:

  • On the first Data Source Configuration Wizard page, set a data adapter as PieChartDataAdapter that allows the vector layer to generate Pie chart items. Then, click Next.

  • In the list of available technologies, select the XML Data item. Then, click Next.

  • On the next page, select the Loading a DataSet from XML item. Then, click Next.

  • On the final Data Source Configuration Wizard page, perform the following steps:

    • Click the Load Xml... button.

    • In the invoked window, browse the rio2016.xml data source file and click Open.

      Note

      The rio2016.xml file is shipped with DevExpress demos and stored in the C:\Users\Public\Documents\DevExpress Demos 17.1\Components\Data directory by default.

    • Define data source members used to generate Pie chart items on the map as follows:

    • Finally, click Finish to complete the data source configuration.

Expanded Step 3. Configure Pie Chart Items

  • To create Pie chart items on the map surface, invoke the Map's Layers Editor as shown below.

  • In the editor, customize the ChartDataSourceAdapter.MeasureRules property to specify how chart items are ranged by their values. To do this, assign a MeasureRules object to the property and specify the MeasureRules.RangeStops property of this object as shown below.

  • Modify the minimum and maximum sizes of pie charts. For this, set ChartDataSourceAdapter.ItemMinSize to 20 and ChartDataSourceAdapter.ItemMaxSize to 60.

  • Specify the MapItemsLayerBase.ToolTipPattern property as follows:

    <b>%A%</b>
    Gold: %V0%
    Silver: %V1%
    Bronze: %V2%
    Total: %V%

  • Finally, handle the layer's LayerBase.DataLoaded event.

    In the event handler, call the MapControl.ZoomToFitLayerItems method to adjust the Map Control's center point and zoom level for the best item representation.

Expanded Step 4. Prepare a Colorizer

The next step is the Colorizer customization. For this, do the following:

The application should look like this if it is launched now :

Expanded Step 5. Add Legends

To add legends to the application, do the following:

Expanded Result

Run the application to see the results.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T174365.

Expanded See Also

How would you rate this topic?​​​​​​​