Geo Maps in Live Charts Windows Forms App

geo maps in C#

The Geo Maps Live Charts control is really easy to customize, here is a collection of maps around the world, you can also create your own.

GeoMaps are alpha, and they should have more features, create a new issue in the github repo with your ideas.

Tools Required:

  1. Visual Studio 2010 or later version.

Steps to Follow:

  1. Create a new Windows Forms application project in Visual Studio.
  2. Go to the solution explorer and right click on the project file and click on Nuget Package Manager.
  3. Now Click on Browse Button and search for Live Charts and select the LiveCharts.WinForms and install it. Make sure you have internet connectivity on your PC.
  4. After successful installation of Live Charts, Rebuild your project or just press Ctrl+Shift+B.
  5. Now go to the onLoad event of your form and add the Following Code:
 LiveCharts.WinForms.GeoMap geoMap = new LiveCharts.WinForms.GeoMap();
            Dictionary<string, double> keyValues = new Dictionary<string, double>();
            keyValues["CN"] = 81285;
            keyValues["US"] = 75066;
            keyValues["IT"] = 74384;
            keyValues["ES"] = 56196;
            keyValues["IR"] = 29046;
            keyValues["FR"] = 25233;
            keyValues["UK"] = 9849;
            keyValues["CA"] = 3579;
            keyValues["PK"] = 1179;
            keyValues["IN"] = 719;

            geoMap.HeatMap = keyValues;

            geoMap.Source = $"{Application.StartupPath}\\World.xml";
            this.Controls.Add(geoMap);
            geoMap.Dock = DockStyle.Fill;

Now Just copy and paste the World.xml file into the project file from solution explorer.

Right click on the World.xml file and click on properties,

Change the Build Action Property to None and Copy to Output Directory to Copy Always.

Rebuild your solution file and try to Run the application.

Video Tutorial:

Geo Maps Live Charts

Source Code:

3 comments

  1. Very informative Geo application. I am wondering if you can give us a tip tip to read or load XML or XLSX or CSV data to the geo map live chart.
    Thanks in advance

Comments are closed.