• Edit
  • Download
    1. <!DOCTYPE html>
    2. <html>
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7.  
    8. <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
    9. <style>
    10. html,
    11. body {
    12. height: 100%;
    13. width: 100%;
    14. margin: 0;
    15. padding: 0;
    16. }
    17.  
    18. #myChart {
    19. height: 100%;
    20. width: 100%;
    21. min-height: 150px;
    22. }
    23.  
    24. .zc-ref {
    25. display: none;
    26. }
    27. </style>
    28. </head>
    29.  
    30. <body>
    31. <div id="zc"></div>
    32. <script>
    33. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
    34. var IDS = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"];
    35. var data = {};
    36. for (var i = 0; i < IDS.length; i++) {
    37. var p = ZC._i_(ZC._r_(10, 90));
    38. data[IDS[i]] = {
    39. value: 0,
    40. dataDem: p,
    41. dataRep: (100 - p),
    42. gradientStops: [0.001, p / 100 - 0.01, p / 100 + 0.01, 0.999].join(' '),
    43. };
    44. }
    45.  
    46. var cdata = {
    47. "type": "tilemap",
    48. "options": {
    49. "map": "USA",
    50. "type": "hex",
    51. "-size-factor": 1.1,
    52. "tile": {
    53. "fill-angle": 0,
    54. "gradient-colors": '#00f #00f #f00 #f00',
    55. "shadow": 1,
    56. "border-width": 1,
    57. "border-color": '#666',
    58. "shadow-distance": 4,
    59. "shadow-alpha": 0.75,
    60. "shadow-color": '#999'
    61. },
    62. "data": data
    63. },
    64. "tooltip": {
    65. "text": "<span style='font-size:21px;font-weight:bold'>%name</span><br><br><span style='color:#00f;font-size:17px'>Democrats:</span> %data-dem%<br><span style='color:#f00;font-size:17px'>Republicans:</span> %data-rep%",
    66. "html-mode": true,
    67. "padding": 10,
    68. "align": "left",
    69. "font-size": 17,
    70. "border-width": 1,
    71. "border-color": "#333",
    72. "font-weight": "600"
    73. },
    74. "plotarea": {
    75. "margin": "10 10 40 10"
    76. }
    77. };
    78.  
    79. zingchart.render({
    80. id: 'zc',
    81. width: 640,
    82. height: 480,
    83. output: 'svg',
    84. data: cdata
    85. });
    86. </script>
    87. </body>
    88.  
    89. </html>
    1. <!DOCTYPE html>
    2. <html>
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7.  
    8. <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    9. </head>
    10.  
    11. <body>
    12. <div id="zc"></div>
    13. </body>
    14.  
    15. </html>
    1. html,
    2. body {
    3. height: 100%;
    4. width: 100%;
    5. margin: 0;
    6. padding: 0;
    7. }
    8.  
    9. #myChart {
    10. height: 100%;
    11. width: 100%;
    12. min-height: 150px;
    13. }
    14.  
    15. .zc-ref {
    16. display: none;
    17. }
    1. var IDS = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"];
    2. var data = {};
    3. for (var i = 0; i < IDS.length; i++) {
    4. var p = ZC._i_(ZC._r_(10, 90));
    5. data[IDS[i]] = {
    6. value: 0,
    7. dataDem: p,
    8. dataRep: (100 - p),
    9. gradientStops: [0.001, p / 100 - 0.01, p / 100 + 0.01, 0.999].join(' '),
    10. };
    11. }
    12.  
    13. var cdata = {
    14. "type": "tilemap",
    15. "options": {
    16. "map": "USA",
    17. "type": "hex",
    18. "-size-factor": 1.1,
    19. "tile": {
    20. "fill-angle": 0,
    21. "gradient-colors": '#00f #00f #f00 #f00',
    22. "shadow": 1,
    23. "border-width": 1,
    24. "border-color": '#666',
    25. "shadow-distance": 4,
    26. "shadow-alpha": 0.75,
    27. "shadow-color": '#999'
    28. },
    29. "data": data
    30. },
    31. "tooltip": {
    32. "text": "<span style='font-size:21px;font-weight:bold'>%name</span><br><br><span style='color:#00f;font-size:17px'>Democrats:</span> %data-dem%<br><span style='color:#f00;font-size:17px'>Republicans:</span> %data-rep%",
    33. "html-mode": true,
    34. "padding": 10,
    35. "align": "left",
    36. "font-size": 17,
    37. "border-width": 1,
    38. "border-color": "#333",
    39. "font-weight": "600"
    40. },
    41. "plotarea": {
    42. "margin": "10 10 40 10"
    43. }
    44. };
    45.  
    46. zingchart.render({
    47. id: 'zc',
    48. width: 640,
    49. height: 480,
    50. output: 'svg',
    51. data: cdata
    52. });