How to remove square label from tooltip and make its information in one line?
chart.js
Solution
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;
}
}
}
}
});
Problem
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 } } }); ```