• Edit
  • Download
    1. <!doctype html>
    2. <html class="zc-html">
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7. <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
    8. <style>
    9. .zc-body {
    10. background: #fff;
    11. }
    12.  
    13. .chart--container {
    14. height: 100%;
    15. width: 100%;
    16. min-height: 530px;
    17. }
    18.  
    19. .zc-ref {
    20. display: none;
    21. }
    22. </style>
    23. </head>
    24.  
    25. <body class="zc-body">
    26. <div id="myChart" class="chart--container">
    27. <a href="https://www.zingchart.com/" rel="noopener" class="zc-ref">Powered by ZingChart</a>
    28. </div>
    29. <script nonce="undefined" src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/374756/fr_pop_2010.js'></script>
    30. <script>
    31. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
    32. const MAX = 150;
    33. const GRAD = {
    34. stops: '0 0.4 0.5 0.6 0.7 1',
    35. colors: '#2B45B4 #5E37AE #B020AF #FF2D98 #FC840A',
    36. };
    37.  
    38. let chartData = {
    39. flat: true,
    40. type: 'null',
    41. backgroundColor: '#fff',
    42. plotarea: {
    43. margin: '25 10 10 10',
    44. },
    45. shapes: [{
    46. type: 'zingchart.maps',
    47. options: {
    48. id: 'mapmain',
    49. name: 'fra',
    50. scale: true,
    51. zooming: false,
    52. panning: false,
    53. scrolling: false,
    54. style: {
    55. flat: true,
    56. controls: {
    57. visible: false,
    58. },
    59. borderAlpha: 0.1,
    60. borderColor: '#fff',
    61. label: {
    62. visible: false,
    63. overlap: false,
    64. text: '%long-text',
    65. },
    66. hoverState: {
    67. visible: false,
    68. backgroundColor: 'none',
    69. shadowAlpha: 0.2,
    70. shadowDistance: 2,
    71. shadow: true,
    72. shadowColor: '#333',
    73. },
    74. },
    75. },
    76. }, ],
    77. heatmap: {
    78. size: 5,
    79. blur: 15,
    80. alpha: 0.75,
    81. minValue: 0,
    82. maxValue: MAX,
    83. gradientStops: GRAD.stops,
    84. gradientColors: GRAD.colors,
    85. },
    86. colorScale: {
    87. aspect: 'gradient',
    88. gradientStops: GRAD.stops,
    89. gradientColors: GRAD.colors,
    90. backgroundColor: null,
    91. alpha: 0.75,
    92. height: '100px',
    93. minValue: 0,
    94. maxValue: MAX,
    95. },
    96. };
    97.  
    98.  
    99. let aData = [];
    100.  
    101. zingchart.bind('myChart', 'load', function() {
    102. window.setInterval(function() {
    103. let l, iIndex, fLon, fLat, iPop, aXY;
    104. let iMaxPoints = 2 * 256;
    105.  
    106. if (aData.length === 0) {
    107. for (l = 0; l < iMaxPoints; l++) {
    108. iIndex = ZC._r_(0, FR_POP_2010.length - 1);
    109. fLon = FR_POP_2010[iIndex][0];
    110. fLat = FR_POP_2010[iIndex][1];
    111. iPop = FR_POP_2010[iIndex][2];
    112. aXY = zingchart.maps.getXY('mapmain', [fLon, fLat]);
    113. aData.push([aXY[0], aXY[1], MAX * Math.random()]);
    114. }
    115. } else {
    116. for (l = aData.length - 1; l >= 0; l--) {
    117. aData[l][2] = Math.min(
    118. MAX,
    119. aData[l][2] - MAX / 19 + (MAX / 20) * Math.random()
    120. );
    121. if (aData[l][2] <= 0) {
    122. aData.splice(l, 1);
    123. }
    124. }
    125. for (l = 0; l < iMaxPoints - aData.length; l++) {
    126. iIndex = ZC._r_(0, FR_POP_2010.length - 1);
    127. fLon = FR_POP_2010[iIndex][0];
    128. fLat = FR_POP_2010[iIndex][1];
    129. iPop = FR_POP_2010[iIndex][2];
    130. aXY = zingchart.maps.getXY('mapmain', [fLon, fLat]);
    131. aData.push([aXY[0], aXY[1], MAX * Math.random()]);
    132. }
    133. }
    134. zingchart.exec('myChart', 'heatmap.setdata', {
    135. data: aData,
    136. });
    137.  
    138. }, 15);
    139. });
    140.  
    141. zingchart.bind('myChart', 'heatmap.mousemove', function(oInfo) {
    142. if (oInfo.value !== null) {
    143. zingchart.exec(oInfo.id, 'colorscale.setvalue', {
    144. graphid: oInfo.graphid,
    145. value: oInfo.value,
    146. });
    147. } else {
    148. zingchart.exec(oInfo.id, 'colorscale.clear', {
    149. graphid: oInfo.graphid,
    150. });
    151. }
    152. });
    153.  
    154. zingchart.loadModules('heatmap,color-scale,maps,maps-fra', function() {
    155. zingchart.render({
    156. id: 'myChart',
    157. width: '100%',
    158. height: '100%',
    159. output: 'canvas',
    160. data: chartData,
    161. modules: 'heatmap,color-scale',
    162. });
    163. });
    164. </script>
    165. </body>
    166.  
    167. </html>
    1. <!doctype html>
    2. <html class="zc-html">
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7. <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    8. </head>
    9.  
    10. <body class="zc-body">
    11. <div id="myChart" class="chart--container">
    12. <a href="https://www.zingchart.com/" rel="noopener" class="zc-ref">Powered by ZingChart</a>
    13. </div>
    14. <script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/374756/fr_pop_2010.js'></script>
    15. </body>
    16.  
    17. </html>
    1. .zc-body {
    2. background: #fff;
    3. }
    4.  
    5. .chart--container {
    6. height: 100%;
    7. width: 100%;
    8. min-height: 530px;
    9. }
    10.  
    11. .zc-ref {
    12. display: none;
    13. }
    1. const MAX = 150;
    2. const GRAD = {
    3. stops: '0 0.4 0.5 0.6 0.7 1',
    4. colors: '#2B45B4 #5E37AE #B020AF #FF2D98 #FC840A',
    5. };
    6.  
    7. let chartData = {
    8. flat: true,
    9. type: 'null',
    10. backgroundColor: '#fff',
    11. plotarea: {
    12. margin: '25 10 10 10',
    13. },
    14. shapes: [{
    15. type: 'zingchart.maps',
    16. options: {
    17. id: 'mapmain',
    18. name: 'fra',
    19. scale: true,
    20. zooming: false,
    21. panning: false,
    22. scrolling: false,
    23. style: {
    24. flat: true,
    25. controls: {
    26. visible: false,
    27. },
    28. borderAlpha: 0.1,
    29. borderColor: '#fff',
    30. label: {
    31. visible: false,
    32. overlap: false,
    33. text: '%long-text',
    34. },
    35. hoverState: {
    36. visible: false,
    37. backgroundColor: 'none',
    38. shadowAlpha: 0.2,
    39. shadowDistance: 2,
    40. shadow: true,
    41. shadowColor: '#333',
    42. },
    43. },
    44. },
    45. }, ],
    46. heatmap: {
    47. size: 5,
    48. blur: 15,
    49. alpha: 0.75,
    50. minValue: 0,
    51. maxValue: MAX,
    52. gradientStops: GRAD.stops,
    53. gradientColors: GRAD.colors,
    54. },
    55. colorScale: {
    56. aspect: 'gradient',
    57. gradientStops: GRAD.stops,
    58. gradientColors: GRAD.colors,
    59. backgroundColor: null,
    60. alpha: 0.75,
    61. height: '100px',
    62. minValue: 0,
    63. maxValue: MAX,
    64. },
    65. };
    66.  
    67.  
    68. let aData = [];
    69.  
    70. zingchart.bind('myChart', 'load', function() {
    71. window.setInterval(function() {
    72. let l, iIndex, fLon, fLat, iPop, aXY;
    73. let iMaxPoints = 2 * 256;
    74.  
    75. if (aData.length === 0) {
    76. for (l = 0; l < iMaxPoints; l++) {
    77. iIndex = ZC._r_(0, FR_POP_2010.length - 1);
    78. fLon = FR_POP_2010[iIndex][0];
    79. fLat = FR_POP_2010[iIndex][1];
    80. iPop = FR_POP_2010[iIndex][2];
    81. aXY = zingchart.maps.getXY('mapmain', [fLon, fLat]);
    82. aData.push([aXY[0], aXY[1], MAX * Math.random()]);
    83. }
    84. } else {
    85. for (l = aData.length - 1; l >= 0; l--) {
    86. aData[l][2] = Math.min(
    87. MAX,
    88. aData[l][2] - MAX / 19 + (MAX / 20) * Math.random()
    89. );
    90. if (aData[l][2] <= 0) {
    91. aData.splice(l, 1);
    92. }
    93. }
    94. for (l = 0; l < iMaxPoints - aData.length; l++) {
    95. iIndex = ZC._r_(0, FR_POP_2010.length - 1);
    96. fLon = FR_POP_2010[iIndex][0];
    97. fLat = FR_POP_2010[iIndex][1];
    98. iPop = FR_POP_2010[iIndex][2];
    99. aXY = zingchart.maps.getXY('mapmain', [fLon, fLat]);
    100. aData.push([aXY[0], aXY[1], MAX * Math.random()]);
    101. }
    102. }
    103. zingchart.exec('myChart', 'heatmap.setdata', {
    104. data: aData,
    105. });
    106.  
    107. }, 15);
    108. });
    109.  
    110. zingchart.bind('myChart', 'heatmap.mousemove', function(oInfo) {
    111. if (oInfo.value !== null) {
    112. zingchart.exec(oInfo.id, 'colorscale.setvalue', {
    113. graphid: oInfo.graphid,
    114. value: oInfo.value,
    115. });
    116. } else {
    117. zingchart.exec(oInfo.id, 'colorscale.clear', {
    118. graphid: oInfo.graphid,
    119. });
    120. }
    121. });
    122.  
    123. zingchart.loadModules('heatmap,color-scale,maps,maps-fra', function() {
    124. zingchart.render({
    125. id: 'myChart',
    126. width: '100%',
    127. height: '100%',
    128. output: 'canvas',
    129. data: chartData,
    130. modules: 'heatmap,color-scale',
    131. });
    132. });