• Edit
  • Download
  • <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingSoft Demo</title>
    
      <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
      <style>
        html,
        body {
          height: 100%;
          width: 100%;
          margin: 0;
          padding: 0;
        }
    
        #myChart {
          height: 100%;
          width: 100%;
          min-height: 150px;
        }
    
        .zc-ref {
          display: none;
        }
      </style>
    </head>
    
    <body>
      <div id="zc"></div>
      <script>
        ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
        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"];
        var data = {};
        for (var i = 0; i < IDS.length; i++) {
          var p = ZC._i_(ZC._r_(10, 90));
          data[IDS[i]] = {
            value: 0,
            dataDem: p,
            dataRep: (100 - p),
            gradientStops: [0.001, p / 100 - 0.01, p / 100 + 0.01, 0.999].join(' '),
          };
        }
    
        var cdata = {
          "type": "tilemap",
          "options": {
            "map": "USA",
            "type": "hex",
            "-size-factor": 1.1,
            "tile": {
              "fill-angle": 0,
              "gradient-colors": '#00f #00f #f00 #f00',
              "shadow": 1,
              "border-width": 1,
              "border-color": '#666',
              "shadow-distance": 4,
              "shadow-alpha": 0.75,
              "shadow-color": '#999'
            },
            "data": data
          },
          "tooltip": {
            "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%",
            "html-mode": true,
            "padding": 10,
            "align": "left",
            "font-size": 17,
            "border-width": 1,
            "border-color": "#333",
            "font-weight": "600"
          },
          "plotarea": {
            "margin": "10 10 40 10"
          }
        };
    
        zingchart.render({
          id: 'zc',
          width: 640,
          height: 480,
          output: 'svg',
          data: cdata
        });
      </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingSoft Demo</title>
    
      <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    </head>
    
    <body>
      <div id="zc"></div>
    </body>
    
    </html>
    html,
    body {
      height: 100%;
      width: 100%;
      margin: 0;
      padding: 0;
    }
    
    #myChart {
      height: 100%;
      width: 100%;
      min-height: 150px;
    }
    
    .zc-ref {
      display: none;
    }
    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"];
    var data = {};
    for (var i = 0; i < IDS.length; i++) {
      var p = ZC._i_(ZC._r_(10, 90));
      data[IDS[i]] = {
        value: 0,
        dataDem: p,
        dataRep: (100 - p),
        gradientStops: [0.001, p / 100 - 0.01, p / 100 + 0.01, 0.999].join(' '),
      };
    }
    
    var cdata = {
      "type": "tilemap",
      "options": {
        "map": "USA",
        "type": "hex",
        "-size-factor": 1.1,
        "tile": {
          "fill-angle": 0,
          "gradient-colors": '#00f #00f #f00 #f00',
          "shadow": 1,
          "border-width": 1,
          "border-color": '#666',
          "shadow-distance": 4,
          "shadow-alpha": 0.75,
          "shadow-color": '#999'
        },
        "data": data
      },
      "tooltip": {
        "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%",
        "html-mode": true,
        "padding": 10,
        "align": "left",
        "font-size": 17,
        "border-width": 1,
        "border-color": "#333",
        "font-weight": "600"
      },
      "plotarea": {
        "margin": "10 10 40 10"
      }
    };
    
    zingchart.render({
      id: 'zc',
      width: 640,
      height: 480,
      output: 'svg',
      data: cdata
    });