网络图符合Sankey图表



在HighCharts中是否有一种方法可以创建一个网络图,其中连接与数据系列成正比的宽度(例如Sankey图?)

该应用程序是"流量流"可视化(但在逻辑点之间而不是物理点之间,因此覆盖到网络图而不是地图上。)

默认情况下不支持这一点,但是您可以通过getLinkAttribues方法的小修改轻松获得所需的结果:

H.seriesTypes.networkgraph.prototype.pointClass.prototype.getLinkAttribues = function() {
    var linkOptions = this.series.options.link,
        maxValue,
        pointOptions = this.options;
    if (!this.linkWidth) {
        this.series.points.forEach(function(p) {
            maxValue = maxValue ?
                Math.max(maxValue, p.options.value) :
                p.options.value;
        });
        this.series.points.forEach(function(p) {
            p.linkWidth = p.options.value * 10 / maxValue;
        });
    }
    return {
        'stroke-width': this.linkWidth || 1,
        stroke: pointOptions.color || linkOptions.color,
        dashstyle: pointOptions.dashStyle || linkOptions.dashStyle
    };
}

实时演示:https://jsfiddle.net/blacklabel/13zt8qds/

文档:https://www.highcharts.com/docs/extering-highcharts

最新更新