javascript - Highcharts 网络图布局
问题描述
我正在使用 Highcharts 库来绘制网络图。但是当数据使两个或多个断开连接的网络时,我遇到了布局问题。然后最大的网络居中并将其他网络推到边缘,使其几乎无法阅读。例子:
Highcharts.chart('container', {
chart: {
type: 'networkgraph',
height: '60%'
},
title: {
text: ''
},
plotOptions: {
networkgraph: {
keys: ['from', 'to'],
}
},
series: [{
dataLabels: {
enabled: true,
linkFormat: ''
},
id: 'demo-tree',
data: [["demo001", "demo002"], ["demo003", "demo004"], ["demo005", "demo002"], ["demo006", "demo007"], ["demo008", "demo009"], ["demo003", "demo010"], ["demo011", "demo009"], ["demo001", "demo008"], ["demo005", "demo001"], ["demo011", "demo008"], ["demo005", "demo006"], ["demo005", "demo007"], ["demo005", "demo011"], ["demo005", "demo009"], ["demo012", "demo004"], ["demo005", "demo008"], ["demo001", "demo006"], ["demo001", "demo007"]],
nodes: [{ "id": "demo001", "marker": { "radius": 119 }, "color": "#dc3545" }, { "id": "demo002", "marker": { "radius": 7 }, "color": "#ffc107" }, { "id": "demo003", "marker": { "radius": 9 }, "color": "#ffc107" }, { "id": "demo004", "marker": { "radius": 8 }, "color": "#ffc107" }, { "id": "demo005", "marker": { "radius": 100 }, "color": "#dc3545" }, { "id": "demo006", "marker": { "radius": 77 }, "color": "#dc3545" }, { "id": "demo007", "marker": { "radius": 76 }, "color": "#dc3545" }, { "id": "demo009", "marker": { "radius": 40 }, "color": "#dc3545" }, { "id": "demo008", "marker": { "radius": 33 }, "color": "#dc3545" }, { "id": "demo010", "marker": { "radius": 5 }, "color": "#28a745" }, { "id": "demo011", "marker": { "radius": 40 }, "color": "#dc3545" }, { "id": "demo012", "marker": { "radius": 4 }, "color": "#28a745" }]
}],
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/networkgraph.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
</figure>
https://jsfiddle.net/jrb471kc/1/
我玩弄了 node.mass 属性无济于事。有人对此有解决方案吗?
编辑1:为了更好地解释我的问题,这是我现在得到的一个例子。我想要的是不将大网络居中的图表。将其向左对齐,以便为 2 个小的空间留出空间。
解决方案
推荐阅读
- android - 如何找到导致我的应用程序每次点击越来越慢的原因?
- ios - 无法将“STPPaymentMethodCardParams”类型的值分配给“STPCardParams”类型
- excel - excel中的奇怪回合
- jquery - 如何将jquery ajax中多个字段的多个图像发布到laravel
- java - 在另一个类中创建一个类的对象,UML 类图中的关系是什么?
- matlab - 如何解决“在计算输出时更新持久变量或状态变量,因此它不能用于代数循环......”图表错误
- python - 当 Socket 从一个 Notebook 移动到另一个 Notebook 时,Gtk 会创建新的 XEMBED Socket
- ruby-on-rails - 如何使用 ougai logger 将日志级别从数字更改为日志名称
- oracle - 在 SQL 中按多列排序
- node.js - Heroku 日志中的“服务”时间是什么意思?