我正在使用chartjs,但我遇到了无法隐藏X轴标签的问题,而悬停时的标签仍应显示。我在stackoverflow上尝试了各种解决方案,但无济于事。
我正在使用最新的chart.js文件,可以在他们的github上找到:https://github.com/nnnick/Chart.js
这是我的一些javascript代码,用于生成图表。
var canvasWeek = {
labels : <?=json_encode($dateArrayWeek);?>,
datasets : [
{
label: "My First dataset",
fillColor : "#3685C6",
strokeColor : "rgba(220,220,220,1)",
pointColor : "#3079AA",
pointStrokeColor : "#fff",
pointHighlightFill : "#e47b25",
pointHighlightStroke : "#FFF",
data : <?=json_encode($brutoValWeek);?>
},
{
label: "My Second dataset",
fillColor : "#3C897A",
strokeColor : "rgba(151,187,205,1)",
pointColor : "#3C897A",
pointStrokeColor : "#fff",
pointHighlightFill : "#e47b25",
pointHighlightStroke : "#FFF",
data : <?=json_encode($nettoValWeek);?>
}
]
}
window.onload = function(){
var ctxW = document.getElementById("canvas-week").getContext("2d");
window.myLine = new Chart(ctxW).Line(canvasWeek, {
responsive: true
});
提前致谢!