【发布时间】:2017-03-06 17:31:14
【问题描述】:
我有一个剑道 ui 图表甜甜圈,我想通过读取参数在绘图时刻设置不透明度为 0.5 的“路径”,在我的情况下,参数是“活动的”我尝试编写“视觉”功能但永远不会被执行...
我已尝试使用 toggleHighlight 但不起作用。
$("#chart").kendoChart({
chartArea: {
width: 440,
height:300
},
seriesDefaults: {
labels: {
template: "# if(dataItem.active) { #☑# } else { #☐# }# #= kendo.format('{0:P}', percentage)#",
position: "outsideEnd",
visible: true,
background: "transparent",
font: "14px Verdana"
},
opacity: 1
},
series: [{
type: "donut",
data: [{
category: "Football",
value: 35,
active: false
}, {
category: "Basketball",
value: 25,
active: false
}, {
category: "Volleyball",
value: 20,
active: true
}],
highlight: {
visible: true,
opacity: 0.5,
toggle: function (e) {
e.preventDefault();
var opacity = e.dataItem.active ? 0.5 : 1;
e.visual.opacity(opacity);
}
},
visual: function (e) {
console.log("visual");
console.log(e);
}
}],
seriesClick: function (e) {
debugger;
console.log(e);
var $this = this;
var series = $this.options.series[0].data;
for (var i = 0; i < series.length; i++) {
if (series[i].category == e.category) {
series[i].active = !series[i].active;
if (series[i].active) {
console.log("TOOGLE");
}
}
}
//this.setOptions({ series: series });
this.refresh();
}
});
有人知道如何在特定“路径”上设置 opacity=0.5?非常感谢大家的帮助!
【问题讨论】:
标签: javascript kendo-ui kendo-chart donut-chart