Difference between revisions of "Widget:Napchart"
From Polyphasic Sleep Wiki
m |
m |
||
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 | + | <canvas id="nc-<!--{substr($url,21)|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-<!--{$url | + | var ctx-<!--{substr($url,21)|escape:'html'}--> = document.getElementById("nc-<!--{substr($url,21)|escape:'html'}-->").getContext('2d') |
− | var id = "<!--{$url | + | var id = "<!--{substr($url,21)|escape:'html'}-->" |
$.getJSON('https://zandimna6174-eval-prod.apigee.net/get?chartid=' + id, function(data) { | $.getJSON('https://zandimna6174-eval-prod.apigee.net/get?chartid=' + id, function(data) { | ||
− | var myNapchart-<!--{$url.substr(21)|escape:'html'}--> = Napchart.init(ctx-<!--{$url | + | var myNapchart-<!--{$url.substr(21)|escape:'html'}--> = Napchart.init(ctx-<!--{substr($url,21)|escape:'html'}-->, data['chartData']) |
console.log(data) | console.log(data) | ||
}); | }); |