简体   繁体   English

Highcharts中的力导向图丢失了线

[英]Force-directed graph in Highcharts has lost its lines

First of all, here's the standard JSFiddle for a Force-Directed Graph . 首先,这是力导向图的标准JSFiddle。

Here's the JSFiddle for my (perhaps misuse of) Force-Directed Graph . 这是我的(可能是滥用) Force- directed Graph的JSFiddle。

My JSFiddle is throwing a larger-than-usual lump of data at Highcharts (scroll right to the bottom of the JS panel to see actual code) which may be the reason why I'm having the problem that I am having, namely that the lines joining the nodes are missing. 我的JSFiddle在Highcharts上抛出了比平时大的数据块(向右滚动到JS面板的底部以查看实际代码),这可能就是我遇到问题的原因,即连接节点的行丢失。

Other non-standard things are happening, eg 其他非标准的事情正在发生,例如

    series: [{
        dataLabels: {
          enabled: true
        },
        data: Data.DAT,
        formatting: Data.FMT
      }
    ]

The formatting tag is permitted (according to Highcharts themselves) as it doesn't clash with anything in Highcharts API. 允许使用formatting标记(根据Highcharts本身),因为它与Highcharts API中的任何内容均不冲突。 In subsequent iterations of the main code base, I put everything into data and refer to DAT and FMT deeper in. 在随后的主要代码库迭代中,我将所有内容都放入了data ,并更深入地介绍了DATFMT

It is possible that something in the node management is amiss 节点管理中的某些内容可能不正确

e.options.data.forEach(function (link, i) {

if (!e.options.formatting[link.from]) {
  console.log("No formatting given for FROM %s", link.from);
} else {
  nodes[link.from] = {
    id: link.from,
    marker: {
      radius: e.options.formatting[link.from].size
    },
    plotX: e.options.formatting[link.from].x,
    plotY: e.options.formatting[link.from].y,
    fixedPosition: true,
    name: e.options.formatting[link.from].name,
    color: e.options.formatting[link.from].colour
  };
}

if (!e.options.formatting[link.to]) {
  console.log("No formatting given for TO %s", link.to);
} else {
  nodes[link.to] = {
    id: link.to,
    marker: {
      radius: e.options.formatting[link.to].size
    },
    plotX: e.options.formatting[link.to].x,
    plotY: e.options.formatting[link.to].y,
    fixedPosition: true,
    name: e.options.formatting[link.to].name,
    color: e.options.formatting[link.to].colour
  };
}
});

However, I'm at a loss trying to work out how to gets the lines to reappear, thus this posting. 但是,我不知所措,想弄清楚如何重新显示这些行,因此发布了这篇文章。

The reason your lines disappear is because you are above turboThreshold . 您的行消失的原因是因为您位于turboThreshold You can see this by looking at console which gives the following error: 您可以通过查看控制台看到以下错误:

Highcharts error #12: www.highcharts.com/errors/12 Highcharts错误#12:www.highcharts.com/errors/12

The fix for this, is either to comply with turbo threshold, that is format your series as an array (which could improve performance). 解决此问题的方法是符合turbo阈值,即将您的系列格式化为数组(这可以提高性能)。 Or to increase the turbo threshold. 或增加turbo阈值。 The latter will make it work, but performance will not be great. 后者会使它工作,但性能不会很好。

Working example: https://jsfiddle.net/ewolden/3qLdmut8/ 工作示例: https : //jsfiddle.net/ewolden/3qLdmut8/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM