Пример #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            /*LiveCharts.WinForms.GeoMap */ this.geoMap = new LiveCharts.WinForms.GeoMap();
            Dictionary <string, double> keyValues     = new Dictionary <string, double>();
            List <CountryInfo>          countries     = DataProvider.AllCountry();
            List <CountryInfo>          sortcountries = countries.OrderBy(o => Int32.Parse(o.Confirmed)).ToList();
            List <CountryInfo>          maxCountries  = new List <CountryInfo>();

            for (int i = sortcountries.Count - 1; i > sortcountries.Count - 7; i--)
            {
                maxCountries.Add(sortcountries.ElementAt(i));
            }
            //MessageBox.Show(maxCountries.ElementAt(0).Country + ", " + maxCountries.ElementAt(1).Country + ", " + maxCountries.ElementAt(2).Country + ", " + maxCountries.ElementAt(3).Country + ", " + maxCountries.ElementAt(4).Country + ", " + maxCountries.ElementAt(5).Country + ", " );

            //da ubacimo zemlje koje imaju najvise zarazenih
            //  keyValues["US"] = Convert.ToInt32(maxCountries.ElementAt(0).Active);
            keyValues["BR"] = Convert.ToInt32(maxCountries.ElementAt(1).Active);
            keyValues["IN"] = Convert.ToInt32(maxCountries.ElementAt(2).Active);
            keyValues["RU"] = Convert.ToInt32(maxCountries.ElementAt(3).Active);
            keyValues["ZA"] = Convert.ToInt32(maxCountries.ElementAt(4).Active);
            keyValues["MX"] = Convert.ToInt32(maxCountries.ElementAt(5).Active);



            geoMap.HeatMap = keyValues;

            geoMap.Source = $"{Application.StartupPath}\\World.xml";
            this.Controls.Add(geoMap);
            geoMap.Dock       = DockStyle.Fill;
            geoMap.LandClick += GeoMap_LandClick;
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Create a GeoMap control
            //LiveCharts.WinForms.GeoMap geoMap1 = new LiveCharts.WinForms.GeoMap();
            LiveCharts.WinForms.GeoMap geoMap1 = new LiveCharts.WinForms.GeoMap();

            // Create a dictionary that we'll fill with Random Data in this example
            Random r = new Random();

            // Note that we define the "key" and number pattern, where the key is the
            // ID of the element in the XML where you want to define the numeric value.
            Dictionary <string, double> values = new Dictionary <string, double>();

            // Fill the specific keys of the countries with a random number

            switch (country)
            {
            case "ukraine":
                values["UA"] = r.Next(560, 1024);
                break;

            case "poland":
                values["PL"] = r.Next(560, 1024);
                break;

            case "united states":
                values["US"] = r.Next(560, 1024);
                break;

            default:
                break;
            }

            geoMap1.HeatMap = values;
            geoMap1.EnableZoomingAndPanning = true;
            geoMap1.Source = $"{Application.StartupPath}\\World.xml";
            geoMap1.Cursor = new Cursor(Application.StartupPath + "\\default.cur");
            // Important, you can only add the control to the form after defining the source of the map,
            // otherwise it will throw a File Not Found exception
            pictureBox12.Controls.Add(geoMap1);

            // Set the style of the control to fill it's container, in this example will fill the entire form
            geoMap1.Dock = DockStyle.Fill;
            //  geoMap1.
        }
Пример #3
0
        public Form1()
        {
            InitializeComponent();

            this.geoMap = new LiveCharts.WinForms.GeoMap();
            Dictionary <string, double> keyValues = new Dictionary <string, double>();
            List <CountryInfo>          countries = DataProvider.AllCountry();

            /*  List<CountryInfo> sortcountries = countries.OrderBy(o => Int32.Parse(o.Confirmed)).ToList();
             * List<CountryInfo> maxCountries = new List<CountryInfo>();
             * for (int i = sortcountries.Count - 1; i > sortcountries.Count - 7; i--)
             * {
             *    maxCountries.Add(sortcountries.ElementAt(i));
             * }
             * keyValues["US"] = Convert.ToInt32(maxCountries.ElementAt(0).Active);
             * keyValues["BR"] = Convert.ToInt32(maxCountries.ElementAt(1).Active);
             * keyValues["IN"] = Convert.ToInt32(maxCountries.ElementAt(2).Active);
             * keyValues["RU"] = Convert.ToInt32(maxCountries.ElementAt(3).Active);
             * keyValues["ZA"] = Convert.ToInt32(maxCountries.ElementAt(4).Active);
             * keyValues["MX"] = Convert.ToInt32(maxCountries.ElementAt(5).Active);*/
            XmlDocument doc = new XmlDocument();

            doc.Load("World.xml");
            XmlNodeList idList   = doc.GetElementsByTagName("Id");
            XmlNodeList nameList = doc.GetElementsByTagName("Name");

            for (int i = 0; i < idList.Count; i++)
            {
                //MessageBox.Show(idList[i].InnerXml);
                //MessageBox.Show(nameList[i].InnerXml);
            }


            for (int i = 0; i < idList.Count; i++)
            {
                CountryInfo ci = DataProvider.getCountryInfo(nameList[i].InnerXml);
                if (idList[i].InnerXml.Equals("US"))
                {
                    ci = DataProvider.getCountryInfo(idList[i].InnerXml);
                    keyValues[idList[i].InnerXml] = Convert.ToInt32(ci.Active);
                }
                else
                {
                    keyValues[idList[i].InnerXml] = Convert.ToInt32(ci.Active);
                }
            }
            geoMap.HeatMap = keyValues;


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

            geoMap.Hoverable = true;
            geoMap.EnableZoomingAndPanning = true;

            geoMap.LandClick += GeoMap_LandClick;



            for (int i = 0; i < 10; i++) // idList.Count; i++)
            {
                // this.Controls[i].ForeColor = ColorTranslator.FromHtml("#f54242");
                // this.Controls[i].BackColor = ColorTranslator.FromHtml("#f54242");
            }
        }