Skip to content

[fix] Prevent Overlapping of Clusters in netjsongraph.js #171 #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 160 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
38a34d4
Refactor CSS for consistency and clarity
cestercian Mar 1, 2025
5ad2983
Merge branch 'master' into master
cestercian Mar 5, 2025
f314caa
Create netjson-cluster-overlap.html
cestercian Mar 12, 2025
09005af
Update netjsongraph.util.js
cestercian Mar 12, 2025
02682ae
Merge branch 'master' of https://github.com/cestercian/netjsongraph.js
cestercian Mar 12, 2025
c02b4ad
Revert "Create netjson-cluster-overlap.html"
cestercian Mar 12, 2025
659b2d6
Reapply "Create netjson-cluster-overlap.html"
cestercian Mar 12, 2025
61fe412
Revert "Reapply "Create netjson-cluster-overlap.html""
cestercian Mar 12, 2025
ff949d7
Reapply "Reapply "Create netjson-cluster-overlap.html""
cestercian Mar 19, 2025
d62d97b
Update index.html
cestercian Mar 19, 2025
a84b1fe
Create netjson-cluster-overlap.html
cestercian Mar 19, 2025
cc0722d
Update netjson-cluster-overlap.html
cestercian Mar 20, 2025
ffc2a0c
Update index.html
cestercian Mar 20, 2025
61a9d91
Update index.html
cestercian Mar 22, 2025
87e82af
Merge branch 'master' into master
cestercian Mar 22, 2025
d3c5c82
Update netjson-cluster-overlap.html
cestercian Mar 22, 2025
882b22c
Update netjson-cluster-overlap.html
cestercian Mar 22, 2025
4579f8b
Update netjson-cluster-overlap.html
cestercian Mar 22, 2025
fc182c7
Update netjson-cluster-overlap.html
cestercian Mar 22, 2025
3f38efd
Update netjson-cluster-overlap.html
cestercian Mar 23, 2025
09f2814
Merge branch 'master' into master
nemesifier Mar 24, 2025
3c0e099
Update netjson-cluster-overlap.html
cestercian Mar 25, 2025
4deeb11
Update netjson-cluster-overlap.html
cestercian Mar 26, 2025
9a23460
Update netjson-cluster-overlap.html
cestercian Mar 26, 2025
9477fe2
Create clusterUtils.js
cestercian Mar 26, 2025
7c2359a
Update netjson-cluster-overlap.html
cestercian Mar 26, 2025
68d9cf9
Update README.md
cestercian Mar 26, 2025
662f6f8
Update README.md
cestercian Mar 26, 2025
52592f6
Update netjson-cluster-overlap.html
cestercian Mar 27, 2025
04679a3
Update .gitignore
cestercian Mar 27, 2025
1ac4463
Update netjson-cluster-overlap.html
cestercian Mar 27, 2025
f445098
Update netjsongraph.config.js
cestercian Mar 27, 2025
20ff2fa
Update netjson-cluster-overlap.html
cestercian Mar 27, 2025
0370da1
Merge branch 'master' into master
cestercian Apr 2, 2025
2206e70
[fix] Netjsongraph.js
cestercian Apr 3, 2025
47213da
[fix] Formatting
cestercian Apr 3, 2025
baa2a04
[fix] netjson-cluster-overlap.html
cestercian Apr 10, 2025
4d70d61
[fix] Netjson cluster overlap.html
cestercian Apr 10, 2025
1b42afd
Merge branch 'master' of https://github.com/cestercian/netjsongraph.js
cestercian Apr 10, 2025
3db782c
[fix] Netjson-cluster-overlap.html
cestercian Apr 10, 2025
1bbc178
Merge branch 'master' into master
cestercian Apr 11, 2025
3b1ad94
Update netjson-clustering.html
cestercian Apr 11, 2025
a287629
[fix] Clustering.html
cestercian Apr 11, 2025
8f8a394
[fix] Index.html
cestercian Apr 11, 2025
73d96c5
[fix] Gitignore
cestercian Apr 11, 2025
ce4313d
[fix] Readme.md
cestercian Apr 11, 2025
32d052c
Merge branch 'master' of https://github.com/cestercian/netjsongraph.js
cestercian Apr 11, 2025
9986a39
[fix] Merge master into feature-branch
cestercian Apr 11, 2025
26e5f67
Merge branch 'master' of https://github.com/cestercian/netjsongraph.js
cestercian Apr 11, 2025
3077a5c
[fix] Readme
cestercian Apr 11, 2025
664e8d4
[fix] Readme
cestercian Apr 12, 2025
8106dbd
[fix] Readme
cestercian Apr 12, 2025
63aaa20
[fix] Netjson-clustering.html
cestercian Apr 12, 2025
455aeb1
Merge branch 'master' into master
cestercian Apr 15, 2025
f4451e8
[fix] Netjson-clustering.html
cestercian Apr 17, 2025
737e393
Update netjsongraph.render.js
cestercian Apr 22, 2025
1656537
Update netjsongraph.config.js
cestercian Apr 22, 2025
c60ad0a
[fix] Netjsongraph.render.js
cestercian Apr 22, 2025
f9a5441
[fix] Netjsongraph.js
cestercian Apr 22, 2025
ce05edf
[fix] Netjsongraph.js
cestercian Apr 22, 2025
81a44b5
[fix] Netjsongraph.spec.js
cestercian Apr 22, 2025
6b6a604
[fix] Netjsongraph.spec.js
cestercian Apr 22, 2025
122fc12
[fix] Netjsongraph.js
cestercian Apr 22, 2025
71e004d
[fix] Netjsongraph.render.js
cestercian Apr 23, 2025
be2e4c6
Revert "[fix] Netjsongraph.render.js"
cestercian Apr 23, 2025
572155f
[fix] Netjsongraph.render.js
cestercian Apr 23, 2025
fd5b529
[change] Netjsongraph.js
cestercian Apr 23, 2025
46390b0
[fix] Formatting
cestercian Apr 23, 2025
d8e7ec6
[fix] Netjson-clustering.html
cestercian Apr 24, 2025
6b60948
[fix] Netjson-clustering.html
cestercian Apr 24, 2025
ab8af74
[change] Removed Comments
cestercian Apr 24, 2025
3a8fd56
[fix] Prettier
cestercian Apr 24, 2025
401de7f
[fix] Netjsongraph.config.js
cestercian Apr 26, 2025
09bc435
[fix] Prettier
cestercian Apr 26, 2025
f7acfcc
[fix] Netjsongraph.render.test.js
cestercian Apr 26, 2025
273f5ac
[fix] Netjsongraph.render.test.js
cestercian Apr 26, 2025
fd0e1bb
Revert "[fix] Netjsongraph.render.test.js"
cestercian Apr 26, 2025
8369683
[fix] Netjsongraph.render.test.js
cestercian Apr 26, 2025
f37ac79
[fix] Eslint
cestercian Apr 26, 2025
08681ff
Merge branch 'master' into master
cestercian May 3, 2025
a79eeec
[fix] Cluster-utlis.js
cestercian May 5, 2025
12b3437
[fix] Netjsongraph.render.js
cestercian May 5, 2025
250a437
[fix] Netjsongraph.render.js
cestercian May 10, 2025
0faba71
Merge branch 'master' into master
nemesifier May 16, 2025
a53f590
[change] Netjsongraph.util.js
cestercian May 26, 2025
cf06552
[change] Revert changes in Netjsongraph.util.js
cestercian May 27, 2025
c76b2d8
Merge branch 'master' into master
cestercian May 30, 2025
200d9f2
[fix] Cluster Overlap
cestercian Jun 2, 2025
c3146ef
Merge branch 'master' into master
cestercian Jun 3, 2025
52ddb86
[change] Refine Changes
cestercian Jun 3, 2025
036c042
[fix] Updated Test cases
cestercian Jun 4, 2025
3a05bc2
[fix] Prettier format
cestercian Jun 4, 2025
53188d8
[fix] Updated clustering logic
cestercian Jun 5, 2025
8c2a572
[fix] Update netjson-clustering.html
cestercian Jun 12, 2025
c8d82dd
[fix] Netjsongraph.util.js
cestercian Jun 12, 2025
ed6a30c
[fix] Zoom function on clicking clusters
cestercian Jun 16, 2025
41cfb93
[fix] Prettier
cestercian Jun 16, 2025
cd8c16d
[chores] Added inline comments
cestercian Jun 18, 2025
dd0cc05
[fix] Clustering logic
cestercian Jun 24, 2025
6b2c070
[change] Updated test cases for the new clustering logic
cestercian Jun 24, 2025
88b7d95
[fix] Qa-checks
cestercian Jun 24, 2025
7df045b
[fix] Qa-checks
cestercian Jun 24, 2025
96abea3
Merge branch 'master' into master
cestercian Jul 2, 2025
d84c9c0
[fix] Created JSON file for exteranl data
cestercian Jul 4, 2025
57fa156
[fix] Updated netjson-clustering.html
cestercian Jul 4, 2025
26cff99
[change] Streamlined map rendering logic
cestercian Jul 9, 2025
0fb5372
Revert "[change] Streamlined map rendering logic"
cestercian Jul 9, 2025
a0cfae4
[fix] Updated the Echarts rendering
cestercian Jul 10, 2025
597411a
[fix] Updated the Echarts rendering
cestercian Jul 10, 2025
77c295b
Merge Conflicts
cestercian Jul 10, 2025
f3a763b
Merge pull request #394 from cestercian/Streamline-Map-Rendering
cestercian Jul 10, 2025
761e8a2
[fix] Streamlining map rendering logic
cestercian Jul 10, 2025
22097e4
[fix] Updated Test Cases
cestercian Jul 14, 2025
59bf856
[fix] Removed Marker-Cluster Dependency
cestercian Jul 14, 2025
af548a7
Merge pull request #399 from cestercian/Uniform-GeoJSON-map-rendering
cestercian Jul 14, 2025
ddfdfc3
[fix] Removed Marker-Cluster Dependency
cestercian Jul 14, 2025
292643e
[fix] Uniform GeoJSON map rendering
cestercian Jul 14, 2025
8f8215d
[fix] Prettier fix
cestercian Jul 14, 2025
cd8c137
Merge pull request #400 from cestercian/Uniform-GeoJSON-map-rendering
cestercian Jul 14, 2025
3f4d8a4
Merge branch 'stramlining-map-rendering' into Streamline-Map-Rendering
cestercian Jul 16, 2025
860f7b8
Merge pull request #401 from cestercian/Streamline-Map-Rendering
cestercian Jul 16, 2025
b9cd9f3
[fix] Removed bloating of if conditions
cestercian Jul 16, 2025
33cf5cd
[fix] QA-checks and Test cases
cestercian Jul 16, 2025
b99c37a
[fix] Qa-checks again
cestercian Jul 16, 2025
ba95437
[fix] Test Coverage
cestercian Jul 16, 2025
adedbe8
[chores] Squashed all commits into one
cestercian Jul 17, 2025
bba47c5
Merge branch 'stramlining-map-rendering' of https://github.com/openwi…
cestercian Jul 17, 2025
48b36ae
[change] Uniform geojson map rendering
cestercian Jul 17, 2025
cbdd6b0
Merge branch 'stramlining-map-rendering' of https://github.com/openwi…
cestercian Jul 17, 2025
4aaecad
feat: Add node clustering in map view
cestercian Jul 17, 2025
7b2fb66
Merge branch 'stramlining-map-rendering' into master
cestercian Jul 17, 2025
f73f161
[fix] QA-checks + yarn.lock changes
cestercian Jul 17, 2025
7adb7a1
Merge branch 'stramlining-map-rendering' into master
cestercian Jul 18, 2025
08361a1
[fix] Changed Config to not show Label for test cases
cestercian Jul 18, 2025
e601fc7
[change] Refactor GeoJSON handling into dedicated module
cestercian Jul 21, 2025
1f8c0bb
[fix] Prettier
cestercian Jul 21, 2025
5d63609
[change] Preserve GeoJSON type in NetJSONGraph
cestercian Jul 22, 2025
03628ca
Merge branch 'stramlining-map-rendering' into master
cestercian Jul 22, 2025
c7c21be
Merge branch 'master' of https://github.com/cestercian/netjsongraph.js
cestercian Jul 22, 2025
7cdb431
[fix] Add GeoJSON samples and refactor geometry handling
cestercian Jul 22, 2025
1d1baa3
Merge branch 'stramlining-map-rendering' into master
cestercian Jul 22, 2025
746143b
Merge branch 'master' of https://github.com/cestercian/netjsongraph.js
cestercian Jul 22, 2025
2cf3441
Revert "[change] Preserve GeoJSON type in NetJSONGraph"
cestercian Jul 24, 2025
2dc36b4
[fix] Improve handling of node/link identities and UI display
cestercian Jul 24, 2025
e4d9471
[chores] Add map auto-fit fix linting
cestercian Jul 24, 2025
1d9696b
[changes] Improve map auto-fit to include polygons
cestercian Jul 24, 2025
99840f1
[Fix] Polygon bounds and add GeoJSON conversion tests
cestercian Jul 24, 2025
a5d99be
[fix] Refactor NetJSON type checks to use isNetJSON utility
cestercian Jul 24, 2025
58570b4
[chores] Update netjsongraph.render.js
cestercian Jul 24, 2025
3650c2c
Merge branch 'stramlining-map-rendering' into master
cestercian Jul 24, 2025
8011b27
[chores] Update test node IDs and labels
cestercian Jul 27, 2025
ea99cb5
[fix] QA-checks
cestercian Jul 27, 2025
db7e856
Merge branch 'stramlining-map-rendering' into master
cestercian Jul 27, 2025
3fd41b8
[change] PrepareData() call for Geojson
cestercian Jul 27, 2025
13b8c04
Merge branch 'stramlining-map-rendering' into master
cestercian Jul 27, 2025
02c50f9
[change] Improve clustering logic for non-Point features
cestercian Jul 28, 2025
39bfdbc
Merge branch 'master' into master
cestercian Jul 29, 2025
6724a85
[fix] Node category assignment and remove polygon rendering
cestercian Jul 29, 2025
758ba41
[chores] QA-checks
cestercian Jul 29, 2025
c04b323
[fix] Preserve GeoJSON feature IDs
cestercian Jul 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,13 @@ For map, you need to configure `mapOptions`. The [`mapOptions`](https://leafletj

You can also customize some global properties with [`echartsOption`](https://echarts.apache.org/en/option.html) in echarts.

### API Introduction
## Automatic Cluster Overlap Prevention

#### Core
When multiple clusters of different categories share identical coordinates, NetJSONGraph now **automatically** offsets them in a circular pattern (pixel-space repulsion). No extra utilities or configuration flags are required—simply enable clustering with a `clusteringAttribute`, and the library handles overlap for you.

- `setConfig`
See the [Cluster Overlap Example](./examples/netjson-clustering.html) to view the result.

Method to set the configuration of the graph. You can use this function to add, update or modify the configuration of the graph.

- `setUtils`

Method to set the utils of the graph. You can use this function to add, update the utils.

- `render`

Method to render the graph.

#### Realtime Update
## Realtime Update

We use [socket.io](https://socket.io/) to monitor data changes which supports WebSockets and Polling. You can call `JSONDataUpdate` when the data change event occurs and pass the data to update the view.

Expand Down Expand Up @@ -795,7 +785,7 @@ Using array files to append data step by step at start.
Similiar to the first method, but easier.
[ Append data using arrays demo](https://openwisp.github.io/netjsongraph.js/examples/netjsonmap-appendData2.html)

The demo shows the clustering of nodes.
The demo shows how to handle overlapping clusters with different statuses.
[ Clustering demo](https://openwisp.github.io/netjsongraph.js/examples/netjson-clustering.html)

### Upgrading from 0.1.x versions to 0.2.x
Expand Down
201 changes: 146 additions & 55 deletions public/example_templates/netjson-clustering.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<title>netjsongraph.js: basic example</title>
<title>NetJSON Cluster Overlap Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
Expand All @@ -14,6 +14,11 @@
<link href="../lib/css/netjsongraph-theme.css" rel="stylesheet" />
<link href="../lib/css/netjsongraph.css" rel="stylesheet" />
<style type="text/css">
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
#legend h4 {
margin: 10px 0;
text-align: center;
Expand All @@ -30,7 +35,6 @@
border-radius: 8px;
color: #000;
font-family: Arial, sans-serif;
font-family: sans-serif;
font-size: 14px;
z-index: 1000;
user-select: text;
Expand All @@ -44,101 +48,188 @@
width: 16px;
margin-right: 5px;
}
#legend .link-up,
#legend .link-down {
.status-ok,
.status-problem,
.status-critical {
display: inline-block;
height: 5px;
border-bottom-width: 6px;
border-bottom-style: solid;
width: 15px;
height: 15px;
margin-right: 5px;
border-radius: 50%;
}
#legend .link-up {
color: #3acc38;
margin-right: 10px;
.status-ok {
background-color: #1ba619;
}
#legend .link-down {
color: red;
margin-right: 10px;
.status-problem {
background-color: #ffa500;
}

@media only screen and (max-width: 850px) {
#legend {
right: 15px;
}
.status-critical {
background-color: #c92517;
}
</style>
</head>
<body>
<script type="text/javascript">
const map = new NetJSONGraph("../assets/data/netjsonmap.json", {
<script type="text/javascript" src="/netjsongraph.min.js"></script>
<script type="module">
function generateNodesForStatus(
status,
baseLat,
baseLng,
minNodes,
maxNodes,
startId,
) {
const nodes = [];
const numNodes =
Math.floor(Math.random() * (maxNodes - minNodes + 1)) + minNodes;
let currentId = startId;

for (let i = 0; i < numNodes; i++) {
nodes.push({
id: `${currentId++}`,
name: `${status.charAt(0).toUpperCase() + status.slice(1)} Node ${i + 1}`,
// Slightly offset location for each node within the group
location: {
lat: baseLat + (Math.random() - 0.5) * 0.001,
lng: baseLng + (Math.random() - 0.5) * 0.001,
},
properties: {status: status},
});
}
return {nodes, nextId: currentId};
}

let nextNodeId = 1;
const criticalNodesResult = generateNodesForStatus(
"critical",
45.4642,
9.19,
7,
15,
nextNodeId,
);
nextNodeId = criticalNodesResult.nextId;
const okNodesResult = generateNodesForStatus(
"ok",
45.4742,
9.18,
12,
22,
nextNodeId,
);
nextNodeId = okNodesResult.nextId;
const problemNodesResult = generateNodesForStatus(
"problem",
45.4842,
9.17,
5,
10,
nextNodeId,
);

const allNodes = [
...criticalNodesResult.nodes,
...okNodesResult.nodes,
...problemNodesResult.nodes,
];

const testData = {
type: "NetworkGraph",
label: "Cluster Overlap Test with Variable Nodes",
nodes: allNodes,
links: [], // Keep links empty for this example
};

const map = new NetJSONGraph(testData, {
render: "map",
clustering: true,
clusteringThreshold: 50,
// set map initial state.
clusteringThreshold: 2,
clusterRadius: 80,
disableClusteringAtLevel: 18,
clusteringAttribute: "status",
clusterSeparation: 20,
mapOptions: {
center: [46.86764405052012, 19.675998687744144],
zoom: 4,
center: [45.4642, 9.19],
zoom: 12,
minZoom: 3,
maxZoom: 18,
nodeConfig: {
label: {
offset: [0, -10],
},
},
},
linkCategories: [
nodeCategories: [
{
name: "down",
linkStyle: {
color: "#c92517",
width: 5,
name: "ok",
nodeStyle: {
color: "#1ba619",
},
},
{
name: "problem",
nodeStyle: {
color: "#ffa500",
},
emphasis: {
linkStyle: {
color: "#FD0101",
opacity: 1,
},
},
{
name: "critical",
nodeStyle: {
color: "#c92517",
},
},
],
// Convert to internal json format
prepareData: (data) => {
data.nodes.map((node) => {
data.nodes.forEach((node) => {
node.label = node.name;
node.properties = Object.assign(node.properties || {}, {
node.properties = {
...node.properties,
location: node.location,
});
});

data.links.map((link) => {
link.properties = link.properties || {};
if (link.properties.status) {
link.category = link.properties.status;
};

if (node.properties && node.properties.status) {
const status = node.properties.status.toLowerCase();
// Map known statuses to categories
if (status === 'ok' || status === 'problem' || status === 'critical') {
node.category = status;
} else {
// Default others to unknown (though this example only generates known ones)
node.category = "unknown";
}
} else {
// Default nodes without status to unknown
node.category = "unknown";
}
});
},
});

const createLegend = (key, name) => {
const createLegend = (key, className) => {
const legendItem = document.createElement("p");
const legendIcon = document.createElement("span");

legendIcon.setAttribute("class", name);

legendIcon.setAttribute("class", className);
legends.appendChild(legendItem);
legendItem.appendChild(legendIcon);

legendItem.innerHTML += key;
return legendItem;
};

const legends = document.createElement("div");
const legendsHeader = document.createElement("h4");
legends.setAttribute("id", "legend");
legendsHeader.innerHTML = "Legend";
legendsHeader.innerHTML = "Node Status";
legends.appendChild(legendsHeader);
legends.appendChild(createLegend("Up", "link-up"));
legends.appendChild(createLegend("Down", "link-down"));

legends.appendChild(createLegend("OK", "status-ok"));
legends.appendChild(createLegend("Problem", "status-problem"));
legends.appendChild(createLegend("Critical", "status-critical"));
document.body.appendChild(legends);

map.render();
try {
map.render();
const leafletMap = map.map;
} catch (e) {
console.error("Error initializing NetJSONGraph:", e);
}
</script>
</body>
</html>
Empty file added src/js/cluster-utils.js
Empty file.
51 changes: 45 additions & 6 deletions src/js/netjsongraph.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const NetJSONGraphDefaultConfig = {
clusteringThreshold: 100,
disableClusteringAtLevel: 8,
clusterRadius: 80,
clusterSeparation: 20,
showMetaOnNarrowScreens: false,
showLabelsAtZoomLevel: 7,
echartsOption: {
Expand Down Expand Up @@ -252,7 +253,26 @@ const NetJSONGraphDefaultConfig = {
radius: 8,
},
},
nodeCategories: [],
nodeCategories: [
{
name: "ok",
nodeStyle: {
color: "#28a745",
},
},
{
name: "problem",
nodeStyle: {
color: "#ffc107",
},
},
{
name: "critical",
nodeStyle: {
color: "#dc3545",
},
},
],
linkCategories: [],

/**
Expand All @@ -265,8 +285,26 @@ const NetJSONGraphDefaultConfig = {
* @this {object} The instantiated object of NetJSONGraph
*
*/
// eslint-disable-next-line no-unused-vars
prepareData(JSONData) {},
prepareData(JSONData) {
if (JSONData && JSONData.nodes) {
JSONData.nodes.forEach((node) => {
if (node.properties && node.properties.status) {
const status = node.properties.status.toLowerCase();
if (
status === "ok" ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we're putting the logic of OpenWISP monitoring in the library, which is wrong.
Once we overcome the issues we're facing, we'll have to clean this up, for the moment it's not a priority, we need to make it work properly first.

status === "problem" ||
status === "critical"
) {
node.category = status;
} else {
node.category = "unknown";
}
} else {
node.category = "unknown";
}
});
}
},

/**
* @function
Expand All @@ -283,16 +321,16 @@ const NetJSONGraphDefaultConfig = {
let nodeLinkData;
if (this.type === "netjson") {
if (type === "node") {
nodeLinkData = this.utils.nodeInfo(data);
({nodeLinkData} = {nodeLinkData: this.utils.nodeInfo(data)});
} else {
nodeLinkData = this.utils.linkInfo(data);
({nodeLinkData} = {nodeLinkData: this.utils.linkInfo(data)});
}

if (this.config.showMetaOnNarrowScreens || this.el.clientWidth > 850) {
this.gui.metaInfoContainer.style.display = "flex";
}
} else {
nodeLinkData = data;
({nodeLinkData} = {nodeLinkData: data});
}

this.gui.getNodeLinkInfo(type, nodeLinkData);
Expand All @@ -311,4 +349,5 @@ const NetJSONGraphDefaultConfig = {
onReady() {},
};

export const {prepareData} = NetJSONGraphDefaultConfig;
export default {...NetJSONGraphDefaultConfig};
Loading
Loading