javascript - jsfiddle code not working in browser 2 -


i copy code link, when paste in text editor , save .html, not run on browser. don't know missed here. please check , tell me solution.

<canvas id="mychart"></canvas>` var data = { labels: ["red","blue"], datasets: [ {   data: [300, 50],   backgroundcolor: ["#ff6384","#36a2eb"], }] };  chart.pluginservice.register({ beforedraw: function(chart) { var width = chart.chart.width, height = chart.chart.height, ctx = chart.chart.ctx, type = chart.config.type;  if (type == 'doughnut')  {     var percent = math.round((chart.config.data.datasets[0].data[0] * 100) /                 (chart.config.data.datasets[0].data[0] +                 chart.config.data.datasets[0].data[1]));         var oldfill = ctx.fillstyle;   var fontsize = ((height - chart.chartarea.top) / 100).tofixed(2);    ctx.restore();   ctx.font = fontsize + "em sans-serif";   ctx.textbaseline = "middle"    var text = percent + "%",       textx = math.round((width - ctx.measuretext(text).width) / 2),       texty = (height + chart.chartarea.top) / 2;    ctx.fillstyle = chart.config.data.datasets[0].backgroundcolor[0];   ctx.filltext(text, textx, texty);   ctx.fillstyle = oldfill;   ctx.save();  }  }  });   var mychart = new chart(document.getelementbyid('mychart'), {   type: 'doughnut',    data: data,    options: {     responsive: true,     legend: {     display: true     }    }    }); 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -