C# Exercises

Home AgriMetSoft About Contact

How to Create Geo HeatMap in WinForms C#

	    
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Geo_Heat_Map_LiveChart
{
  public partial class Form1 : Form
  {
    // NuGet\Install-Package LiveCharts.WinForms -Version 0.9.7.1
    // https://www.iban.com/country-codes
    public Form1()
    {
      InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
      LiveCharts.WinForms.GeoMap geoMap = new LiveCharts.WinForms.GeoMap();
        Dictionary<string, double> keyValues = new Dictionary<string, double>();
        keyValues["CN"] = 72000;
        keyValues["US"] = 75066;
        keyValues["IT"] = 74384;
        keyValues["ES"] = 56196;
        keyValues["IE"] = 29046;
        keyValues["FR"] = 25233;
        keyValues["UK"] = 9849;
        keyValues["CA"] = 3579;
        keyValues["PK"] = 1179;
        keyValues["IN"] = 719;

        keyValues["ZA"] = 28836;
        keyValues["AU"] = 62025;
        keyValues["RU"] = 52136;
        geoMap.HeatMap = keyValues;
        geoMap.Source = Application.StartupPath + "\\World.xml";
      this.Controls.Add(geoMap);
        geoMap.Dock = DockStyle.Fill;
    }
  }
}
		
	 


Download the project of Visual Studio 2013 in DropBox Download


How to Add Geo Heat Map in Winforms C# by LiveChart


List of Exercises