Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 9th, 2020 306 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- Styles -->
  2. <style>
  3. #chartdiv {
  4.   width: 100%;
  5.   max-width:100%;
  6.   height: 500px;
  7. }
  8.  
  9. #hiddenchartdiv{
  10.   width: 100%;
  11.   max-width:100%;
  12.   height: 500px;
  13.   visibility:hidden;
  14.   position:absolute;
  15.   top:0px;
  16. }
  17. </style>
  18.  
  19. <!-- Resources -->
  20. <script src="https://www.amcharts.com/lib/4/core.js"></script>
  21. <script src="https://www.amcharts.com/lib/4/maps.js"></script>
  22. <script src="https://www.amcharts.com/lib/4/geodata/worldHigh.js"></script>
  23. <script src="https://www.amcharts.com/lib/4/themes/animated.js"></script>
  24.  
  25. <!-- Chart code -->
  26. <script>
  27. am4core.ready(function() {
  28.  
  29. // Themes begin
  30. am4core.useTheme(am4themes_animated);
  31. // Themes end
  32.  
  33.  
  34.  
  35. var countryCodes = ["AF", "AO", "AR", "AM", "AU", "AT", "AZ", "BD", "BY", "BE", "BO", "BA", "BW", "BR", "BG", "KH", "CM", "CA", "CF", "TD", "CL", "CN", "CO", "CG", "CD", "CR", "CI", "HR", "CU", "CY", "CZ", "DK", "EC", "EG", "ER", "EE", "ET", "FI", "FR", "GE", "DE", "GR", "GL", "GP", "GT", "GN", "GW", "GY", "HT", "HN", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IL", "IT", "JM", "JP", "JO", "KZ", "KE", "KP", "KR", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LT", "LU", "MK", "MG", "MY", "ML", "MT", "MR", "MX", "MD", "MN", "ME", "MA", "MZ", "MM", "NA", "NP", "NL", "NZ", "NI", "NE", "NG", "NO", "OM", "PK", "PA", "PG", "PY", "PE", "PH", "PL", "PT", "RO", "RU", "SA", "SN", "RS", "SK", "SI", "SO", "ZA", "SS", "ES", "SD", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TN", "TR", "TM", "UA", "AE", "GB", "US", "UY", "UZ", "VE", "VN", "YE", "ZM", "ZW"];
  36.  
  37. var chart = am4core.create("chartdiv", am4maps.MapChart);
  38.  
  39.  
  40. try {
  41.   chart.geodata = am4geodata_worldHigh;
  42. }
  43. catch (e) {
  44.   chart.raiseCriticalError(new Error("Map geodata could not be loaded. Please download the latest <a href=\"https://www.amcharts.com/download/download-v4/\">amcharts geodata</a> and extract its contents into the same directory as your amCharts files."));
  45. }
  46.  
  47. chart.projection = new am4maps.projections.Mercator();
  48. chart.padding(10, 20, 10, 20);
  49. chart.minZoomLevel = 0.9;
  50. chart.zoomLevel = 0.9;
  51. chart.maxZoomLevel = 1;
  52.  
  53. var polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
  54. polygonSeries.useGeodata = true;
  55. polygonSeries.include = ["AF"];
  56.  
  57.  
  58. var chart1 = am4core.create("hiddenchartdiv", am4maps.MapChart);
  59. chart1.padding(10, 20, 10, 20);
  60. chart1.geodata = am4geodata_worldHigh;
  61. chart1.projection = new am4maps.projections.Mercator();
  62.  
  63. var polygonSeries1 = chart1.series.push(new am4maps.MapPolygonSeries());
  64. polygonSeries1.useGeodata = true;
  65. polygonSeries1.include = ["AF"];
  66.  
  67.  
  68. var label = chart.chartContainer.createChild(am4core.Label);
  69. label.x = 100;
  70. label.y = 100;
  71. label.fill = am4core.color("#000000");
  72. label.fontSize = 35;
  73. label.fontWeight = "bold";
  74. label.text = "Afghanistan";
  75. label.fillOpacity = 0.2;
  76.  
  77. var slider = chart.createChild(am4core.Slider);
  78. slider.padding(0, 15, 0, 60);
  79. slider.background.padding(0, 15, 0, 60);
  80. slider.marginBottom = 15;
  81. slider.valign = "bottom";
  82.  
  83. var currentIndex = -1;
  84. var colorset = new am4core.ColorSet();
  85.  
  86. setInterval(function () {
  87.   var next = slider.start + 1 / countryCodes.length;
  88.   if (next >= 1) {
  89.     next = 0;
  90.   }
  91.   slider.animate({ property: "start", to: next }, 300);
  92. }, 2000)
  93.  
  94. slider.events.on("rangechanged", function () {
  95.   changeCountry();
  96. })
  97.  
  98. function changeCountry() {
  99.   var totalCountries = countryCodes.length - 1;
  100.   var countryIndex = Math.round(totalCountries * slider.start);
  101.  
  102.   var morphToPolygon;
  103.  
  104.   if (currentIndex != countryIndex) {
  105.     polygonSeries1.data = [];
  106.     polygonSeries1.include = [countryCodes[countryIndex]];
  107.  
  108.     currentIndex = countryIndex;
  109.  
  110.     polygonSeries1.events.once("validated", function () {
  111.  
  112.       morphToPolygon = polygonSeries1.mapPolygons.getIndex(0);
  113.       if(morphToPolygon){
  114.         var countryPolygon = polygonSeries.mapPolygons.getIndex(0);
  115.  
  116.         var morpher = countryPolygon.polygon.morpher;
  117.         var morphAnimation = morpher.morphToPolygon(morphToPolygon.polygon.points);
  118.  
  119.         var colorAnimation = countryPolygon.animate({ "property": "fill", "to": colorset.getIndex(Math.round(Math.random() * 20)) }, 1000);
  120.  
  121.         var animation = label.animate({ property: "y", to: 1000 }, 300);
  122.  
  123.         animation.events.once("animationended", function () {
  124.           label.text = morphToPolygon.dataItem.dataContext["name"];
  125.           label.y = -50;
  126.           label.animate({ property: "y", to: 200 }, 300, am4core.ease.quadOut);
  127.         })
  128.       }
  129.     })
  130.   }
  131. }
  132.  
  133.  
  134. }); // end am4core.ready()
  135. </script>
  136.  
  137. <!-- HTML -->
  138. <div id="chartdiv"></div>
  139. <div id="hiddenchartdiv"></div>
  140. amCharts
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top