ksh*_*ksh 3 javascript jquery morris.js
如何禁用莫里斯甜甜圈图中的悬停选项,每当用户将指针移到图表上时,其值应保持不变。
var m111 = new Morris.Donut({
element: 'donut-chart111',
data: [
{label: "R", value: ra},
{label: "C", value: cp},
{label: "M", value: mp},
{label: "MA", value: map},
{label: "A", value: ap}
],
colors: ['#D9534F','#1CAF9A','#428BCA','#5BC0DE','#428BCA']
});
Run Code Online (Sandbox Code Playgroud)
You can loop through and modify the segment handlers to your liking.
To remove the hover handler (and optionally add a click handler) you could for example do this:
var donut = new Morris.Donut({
// ...
});
for(i = 0; i < donut.segments.length; i++) {
// Remove hover handlers:
donut.segments[i].handlers['hover'] = [];
// If you want select functionality through click:
donut.segments[i].handlers['click'] = [donut.select];
}
Run Code Online (Sandbox Code Playgroud)
请参阅此 JSFiddle 的实际演示。
| 归档时间: |
|
| 查看次数: |
1452 次 |
| 最近记录: |