[Chartjs]-How can I fasten up the Chart.js graph generation from JQuery over PHP and mySQL?

1👍 ✅ You would try to embed the data from php directly. or include the file using <?php include(‘getTestData.php’); ?> such like below to replace the ajax get request. <?php foreach($dataGet->label as $label){ ?> labels.push(“<?= $label ?>”); <?= } ?> <?php foreach($dataGet->temperature as $temperature){ ?> temperature.push(“<?= $temperature ?>”); <?= } ?> <?php foreach($dataGet->humidity as $humidity){ … Read more

[Chartjs]-Tooltip alignement with Chart.js v2

1👍 Thank you @Tektiv, I’ve updated your answer as it didn’t solve my issue on chromium 54 as you can see here: I’m using this option: Chart.defaults.global.tooltips.footerFontSize = 0; Along with this footer callback: options: { tooltips: { callbacks: { footer: function() { return ‘ ‘; }, label: PercentageTooltip } } } Here’s the jsFiddle, … Read more

[Chartjs]-Chart.JS – Fill Donut

1👍 ✅ Add this after options: Chart.types.Doughnut.extend({ name: “DoughnutAlt”, draw: function () { Chart.types.Doughnut.prototype.draw.apply(this, arguments); //find the center point var x = this.chart.canvas.clientWidth / 2; var y = this.chart.canvas.clientHeight / 2; //render the text this.chart.ctx.beginPath(); this.chart.ctx.arc(x,y,100,0,2*Math.PI); this.chart.ctx.fillStyle = ‘#ffff00’; this.chart.ctx.fill(); } }); Change myNewChart = new Chart(ct).Doughnut(data, options); to myNewChart = new Chart(ct).DoughnutAlt(data, options); Updated … Read more

[Chartjs]-React render function preventing creating new canvas element on each time invoked – Charts.js

1👍 ✅ I think the problem is not on React, but in ChartJS … It’s getting new information… but instead of updating … it is inserting new canvas.. Try setting redraw. From the docs https://github.com/reactjs/react-chartjs if data passed into the component changes, points will animate between values using chart.js’ .update(). If you want the chart … Read more

[Chartjs]-Binding Chart to Canvas height width

1👍 ✅ It might be easier to wrap the canvas in a div/span/something and set the size there. As you have set responsive: true this means that chart.js tries to fill the parent on resize and it does this by setting the canvas height and width. https://jsfiddle.net/zpvfph9m/1/ <div style=”width:50%”> <canvas id=”fisheye” width=”400″ height=”400″></canvas> </div> Would … Read more