Advertisement
Guest User

Untitled

a guest
Apr 13th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  4. <title>World Distribution of Dash Masternodes</title>
  5. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  6. <script src="https://code.highcharts.com/maps/highmaps.js"></script>
  7. <script src="https://code.highcharts.com/maps/modules/data.js"></script>
  8. <script src="https://code.highcharts.com/mapdata/custom/world.js"></script>
  9. <script src="https://nazar-pc.github.io/PickMeUp/js/jquery.pickmeup.js"></script>
  10. <link rel="stylesheet" type="text/css" href="https://nazar-pc.github.io/PickMeUp/css/pickmeup.css"/>
  11. <script type="text/javascript">
  12. $(function () {
  13. var timestamp = new Date();
  14. var beginOfDay = (timestamp - (timestamp % 86400000));
  15. var file = timestamp.getFullYear() + ('0' + (timestamp.getMonth()+1)).slice(-2) + '/' + beginOfDay / 1000 + '.json';
  16. var a = $.getJSON(file, function (data) {
  17. var b = $.parseJSON(a.responseText);
  18. var totalMNs = 0;
  19. $.each(b, function() {
  20. totalMNs += this.z;
  21. });
  22. var mapData = Highcharts.geojson(Highcharts.maps['custom/world']);
  23. $('#container').highcharts('Map', {
  24. chart: {
  25. borderWidth : 0
  26. },
  27.  
  28. title: {
  29. text: 'World Distribution of Dash Masternodes'
  30. },
  31.  
  32. subtitle: {
  33. useHTML: true,
  34. text: 'Total: '+totalMNs+', updated: <span id="date">' + a.getResponseHeader("Last-Modified") + '</span>'
  35. },
  36.  
  37. legend: {
  38. enabled: false
  39. },
  40.  
  41. mapNavigation: {
  42. enabled: true,
  43. buttonOptions: {
  44. verticalAlign: 'bottom'
  45. }
  46. },
  47.  
  48. series: [{
  49. name: 'Countries',
  50. mapData: mapData,
  51. color: '#E0E0E0',
  52. enableMouseTracking: false
  53. }, {
  54. type: 'mapbubble',
  55. mapData: mapData,
  56. color: '#1c75bc',
  57. name: 'count',
  58. joinBy: ['iso-a2', 'code'],
  59. data: data,
  60. minSize: 3,
  61. maxSize: '15%',
  62. tooltip: {
  63. headerFormat: '',
  64. pointFormat: '{point.code}: {point.z}'
  65. }
  66. }]
  67. },function(){
  68. $('#date').click(function(){
  69. $('#datepicker').toggle();
  70. });
  71. });
  72. });
  73. tMax = new Date(timestamp.getUTCFullYear(), timestamp.getUTCMonth(), timestamp.getUTCDate(), 0, 0, 0);
  74. $('#datepicker').pickmeup({
  75. flat: true,
  76. min: new Date(2016,3,9),
  77. max: tMax,
  78. change: function () {
  79. $('#datepicker').toggle();
  80. var pDate = new Date(parseInt($('#datepicker').pickmeup('get_date', 's')) * 1000)
  81. var uDate = Date.UTC(pDate.getFullYear(), pDate.getMonth(), pDate.getDate(), 0, 0, 0);
  82. var file = pDate.getFullYear() + ('0' + (pDate.getMonth()+1)).slice(-2) + '/' + uDate / 1000 + '.json';
  83. var a = $.getJSON(file, function (data) {
  84. var chart = $('#container').highcharts();
  85. chart.series[1].setData(data);
  86. var b = $.parseJSON(a.responseText);
  87. var totalMNs = 0;
  88. $.each(b, function() {
  89. totalMNs += this.z;
  90. });
  91. chart.setTitle(null, { text: 'Total: '+totalMNs+', updated: <span id="date">' + a.getResponseHeader("Last-Modified") + '</span>'});
  92. $('#date').click(function(){
  93. $('#datepicker').toggle();
  94. });
  95. })
  96. }
  97. });
  98. });
  99. </script>
  100. <style>
  101. body {margin:0;padding:0;}
  102. #container {
  103. width: 100%;
  104. height: 100%;
  105. margin: 0 auto;
  106. }
  107. #dp-container {
  108. width: 100%;
  109. top: 58px;
  110. position: absolute;
  111. text-align: center;
  112. }
  113. #date {
  114. border-bottom: #333 1px dotted;
  115. cursor: pointer;
  116. position: relative;
  117. }
  118. #datepicker {
  119. display: none;
  120. //position: absolute;
  121. //left: calc(50% - 50px);
  122. margin: 0 auto;
  123. top: 58px;
  124. }
  125. </style>
  126. </head>
  127. <body>
  128. <noscript><p align="center">JavaScript not allowed :(</p></noscript>
  129. <div id="container"></div>
  130. <div id="dp-container"><div id="datepicker"></div></div>
  131. </body>
  132. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement