How can I remove this square from tooltip?
I would prefer if I could manage to just have it one line like this: February - 2
var data = { labels: ['January', 'February', 'March'], datasets: [ { data: [1,2,3] } ] }; var myLineChart = new Chart(document.getElementById('chart'), { type: 'line', data: data, options: { legend: { display: false } } });
Add this in your options
object
tooltips: { displayColors: false }
here you go:
jsfiddle: http://jsfiddle.net/1v9fy5mz/
code:
html
<canvas id="canvas"></canvas>
js:
var ctx = document.getElementById("canvas").getContext("2d"); var data = { labels: ['January', 'February', 'March'], datasets: [{ data: [1, 2, 3] }] }; var myLineChart = new Chart(ctx, { type: 'line', data: data, options: { showAllTooltips: true, tooltips: { custom: function(tooltip) { if (!tooltip) return; // disable displaying the color box; tooltip.displayColors = false; }, callbacks: { // use label callback to return the desired label label: function(tooltipItem, data) { return tooltipItem.xLabel + " :" + tooltipItem.yLabel; }, // remove title title: function(tooltipItem, data) { return; } } } } });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With