ChAoS UnItY的分析頁面(源代碼)
<html>
<head>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
</head>
<canvas id="example" width="400" height="200"></canvas>
<script type="text/javascript">
 var URL= location.href;
 if (URL.indexOf("#") > 0) {
  var amount = URL.split("#")[1];
  var elementI = document.createElement("div");
  var textI = document.createTextNode(amount.split("=")[1]);
  elementI.appendChild(textI);
  document.body.appendChild(elementI);
  var amountI = parseInt(amount.split("=")[1]);
  console.log(amountI);
  var ctx = document.getElementById( "example" ),
          example = new Chart(ctx, {
              type: "bar",
              data: {
                  labels: [ "Red", "Green", "Blue" ], 
                  datasets: [{
                      label: "# of Votes", 
                      data: [ amountI, 19, 3 ], 
                      backgroundColor: [ 
                      "#FF0000",
                      "#00FF00",
                      "#0000FF",
                      ],
                      borderWidth: 1 
                  }]
              }
          });
 }
</script>
</html>
<html>
<head>
</head>
<script type="text/javascript">
var URL= location.href;
if (URL.indexOf("#") > 0) {
 var key = URL.split("#")[1].split("=")[0];
 var amount = URL.split("#")[1].split("=")[1];
 sessionStorage.setItem(key, JSON.stringify(amount));
}
</script>
</html>
除非特別註明,本頁內容採用以下授權方式: Creative Commons Attribution-ShareAlike 3.0 License