javascript - 网络图 - 有没有办法在点击网络图中隐藏特定节点?
解决方案
click
要隐藏事件使用remove
方法上的特定点:
plotOptions: {
networkgraph: {
...,
point: {
events: {
click: function() {
this.remove();
}
}
}
}
}
但是,networkgraph
图表中存在与remove
方法相关的错误(此处报告:https ://github.com/highcharts/highcharts/issues/10565 ),因此您还需要使用解决方法:
Highcharts.wrap(
Highcharts.seriesTypes.networkgraph.prototype, 'generatePoints',
function(p) {
if (this.nodes) {
this.nodes.forEach(function(node) {
node.destroy();
});
this.nodes.length = 0;
}
return p.apply(this, Array.prototype.slice.call(arguments, 1));
}
);
现场演示: https ://jsfiddle.net/BlackLabel/m9tjb481/
API 参考: https ://api.highcharts.com/class-reference/Highcharts.Point#remove
推荐阅读
- sql - How to extract Column names and its values from the Database table, which are concatenated
- excel-formula - Excel 公式查找,这是如何工作的?
- php - 运行一个繁重的 PHP 脚本,将数据插入 Wordpress 数据库
- apache-spark - Spark FP-Growth 算法中的“lift”参数是什么意思?
- kaitai-struct - Kaitai Struct 外部文件中引用枚举
- python-3.x - 如何在 Python 中将 int 数据类型的分类数据更改为数值数据
- sql-server - 在 SQL Server 中展平计划数据
- c++ - 托管调试不可用(未找到 mscordbi.dll 的版本)
- python - 这行代码在python中是如何工作的?
- asp.net-core - 从 2.2 .Net core 迁移到 3.0 Cors 错误