当用户使用 ShieldUI 单击 ChartLegend 时,如何禁用 hide/show 图表的功能?
how to disable the functionality to hide/show the chart when user click ChartLegend with ShieldUI?
这里有一个 ShieldUI Chart 的示例,是否有人可以在用户单击 CharLegent 时禁用 hide/show 图表的功能?我的意思是,正如您所见,当用户点击 "Braking Distance" 时,黄色图表已被隐藏。我想禁用那种功能。
您应该在 legendSeriesClick
事件处理函数中阻止事件被触发,如下所示:
$(document).ready(function () {
$("#chart").shieldChart({
...
events: {
legendSeriesClick: function (e) {
// stop the series item click event, so that
// user clicks do not toggle visibility of the series
e.preventDefault();
}
}
});
});
此 chart demo 中显示了一个完整的示例。
这里有一个 ShieldUI Chart 的示例,是否有人可以在用户单击 CharLegent 时禁用 hide/show 图表的功能?我的意思是,正如您所见,当用户点击 "Braking Distance" 时,黄色图表已被隐藏。我想禁用那种功能。
您应该在 legendSeriesClick
事件处理函数中阻止事件被触发,如下所示:
$(document).ready(function () {
$("#chart").shieldChart({
...
events: {
legendSeriesClick: function (e) {
// stop the series item click event, so that
// user clicks do not toggle visibility of the series
e.preventDefault();
}
}
});
});
此 chart demo 中显示了一个完整的示例。