Difference between revisions of "Widget:Napchart"

From Polyphasic Sleep Wiki
m
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<includeonly>
 
<includeonly>
 
<div style="padding:5px">
 
<div style="padding:5px">
<div style="width:300px;height:300px;">
+
<div style="width:320px;height:320px;">
<canvas id="myNapchart" width:100%;height:100%;"></canvas></div></div>
+
<canvas id="nc-<!--{$url|escape:'html'}-->" width:100%;height:100%;"></canvas></div></div>
 
<script src="/napchart.min.js"></script>
 
<script src="/napchart.min.js"></script>
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
 
<script>
 
<script>
   var ctx = document.getElementById("myNapchart").getContext('2d')
+
   eval("var ctx_" + "<!--{$url|escape:'html'}-->".split('/').pop() + " = document.getElementById(\"nc-<!--{$url|escape:'html'}-->\").getContext('2d')")
  var id = "<!--{$url|escape:'html'}-->".slice(21)
+
   $.getJSON('https://cache.polysleep.org/napcharts/' + "<!--{$url|escape:'html'}-->".split('/').pop() + ".json", function(data) {
   $.getJSON('https://zandimna6174-eval-prod.apigee.net/get?chartid=' + id, function(data) {
+
     eval("var myNapchart_" + "<!--{$url|escape:'html'}-->".slice(21) + " = Napchart.init(ctx_" + "<!--{$url|escape:'html'}-->".split('/').pop() + ", data['chartDocument']['chartData'])");
     var myNapchart = Napchart.init(ctx, data['chartData'])
+
     console.log(data);
     console.log(data)
 
 
});
 
});
 
 
 
 
 
</script>
 
</script>
 
</includeonly>
 
</includeonly>

Latest revision as of 23:11, 13 July 2021