如何从工具提示中删除此方块?
我更愿意,如果我能设法让它像这样:2月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
}
}
});
Run Code Online (Sandbox Code Playgroud)
Ahm*_*lam 30
干得好:
jsfiddle:http://jsfiddle.net/1v9fy5mz/
码:
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;
}
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
Sep*_*ano 15
在你的options对象中添加它
tooltips: {
displayColors: false
}
Run Code Online (Sandbox Code Playgroud)
小智 6
tooltips: {
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;
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13213 次 |
| 最近记录: |