Lesson 3 - Add Analytical Data to a Geographical Map

  • 4 minutes to read

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:

Step 1. Add a Map Control

Step 2. Prepare a Vector Items Layer and Load Data

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

    add-vector-layer

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

    run-data-source-wizard

  • 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.

    select-PieChartDataAdapter

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

    data-source-wizard-xml-data

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

    select-loading-dataset-from-xml

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

    • Click the Load Xml... button.

      data-source-configuration-wizard-load-xml

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

      pie-adapter-data-members

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

Step 3. Configure Pie Chart Items

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 :

lesson3-loaded-data

Step 5. Add Legends

To add legends to the application, do the following:

Result

Run the application to see the results.

getting-started-lesson3

TIP

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

See Also