0
我正在使用Chart.js 2.0 公式:失敗率:失敗計數/總計數。 我有一個失敗率,失敗計數和總數的數組。Chart.js自定義工具提示以顯示更多數據
在折線圖中繪製組件對時間的失敗率很簡單,但現在我還希望在用戶將鼠標懸停在工具提示上時顯示失敗計數和總計數。我無法弄清楚如何定製它。
我們e.time,e.count,e.failure_count,e.rate
new Chart(document.getElementById(event_id).getContext("2d"), {type: "line", data:
{
labels: e.time,
datasets: [
{
label: "Failure Rate",
fill: false,
borderColor: "#4caf50",
backgroundColor: "#4caf50",
pointBorderWidth: 1,
pointHoverRadius: 3,
data: e.rate
}
]
}, options: {
scales: {
yAxes: [{
ticks: {
suggestedMin: -1,
suggestedMax: 6
}
}]
},
tooltips: {
custom: function(tooltip) {
tooltip.text= "Not working????"
}
}
}
});