簡體   English   中英

如何從雷達圖中的鼠標懸停結果中刪除數據值?

[英]How do you remove the data value from the mouse-over result in radar chart?

目前,我正在處理一組動態數據和Chart.js。 我正在使用的數據中沒有標准化的比例尺,因此我創建了一個簡單的算法,例如:

3 out of 7 for question 1 [3 * (12 / 7)]
2 out of 9 for question 2 [2 * (12 / 9)]
6 out of 7 for question 3 [6 * (12 / 7)]
So that all the results for the Radar Graph are measured equally at 12.

這樣,即使該點相對於圖形其余部分的位置正確,該值也將不正確。

[Label]Question 1 (3/7) : [Value]5.14

通過將標簽與標簽數組中的數據結合起來,我已經在標簽中包含了真值。

因此,當鼠標懸停在圖表上的輻條或圓點上時,我只想顯示標簽。

Question 1 (3/7)

有沒有辦法做到這一點而又不會弄亂Chart.js文件呢?

使用tooltipTemplate選項

new Chart(ctx).Radar(data, {
    tooltipTemplate: "<%=label%>",
});

小提琴-http: //jsfiddle.net/dz6mt4dy/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM