Widget:Napchart: Difference between revisions
From Polyphasic Sleep Wiki
Tag: Undo |
Tag: Undo |
||
| Line 2: | Line 2: | ||
<div style="padding:5px"> | <div style="padding:5px"> | ||
<div style="width:320px;height:320px;"> | <div style="width:320px;height:320px;"> | ||
<canvas id="nc-<!--{$url|escape:'html'}--> | <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> | <script> | ||
var | eval("var ctx_" + "<!--{$url|escape:'html'}-->".split('/').pop() + " = document.getElementById(\"nc-<!--{$url|escape:'html'}-->\").getContext('2d')") | ||
$.getJSON('https://cache.polysleep.org/napcharts/' + "<!--{$url|escape:'html'}-->".split('/').pop() + ".json", function(data) { | |||
eval("var myNapchart_" + "<!--{$url|escape:'html'}-->".slice(21) + " = Napchart.init(ctx_" + "<!--{$url|escape:'html'}-->".split('/').pop() + ", data['chartDocument']['chartData'])"); | |||
console.log(data); | |||
}); | |||
. | |||
</script> | </script> | ||
</includeonly> | </includeonly> | ||
