Addding Sigma.js and Graphology.js gives error

73 views
Skip to first unread message

Timothy Hanson

unread,
Jan 27, 2025, 10:40:11 AMJan 27
to Google Apps Script Community
I am trying to load sigma.js and  Graphology in a Google sheet HTML file. But I can not get it to load.

After deploying, the js console gives: `Sigma.js is not loaded.

I get from the JS console 
userCodeAppPanel:3 Uncaught ReferenceError: graphology is not defined
`

Here is the Google sheet I am using:
https://docs.google.com/spreadsheets/d/1FjSzGkk2szClcJtDe8eWhtWck-5YqXiNjtugF9pYYeI/edit?usp=sharing

Edit: Here is the deploy link
https://script.google.com/macros/s/AKfycbyENWD_daeriBJDk5wAyuHux5zYXHGnlBiceAF7-_7vK4YGd9TAiGcE_ragHMSaqErh/exec

Any insight on what is going on would be appreciated.

Thanks

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sigma.js with Graphology</title>

  <!-- Sigma.js -->

  <!-- Graphology -->

  <style>
    #sigma-test {
      width: 600px;
      height: 400px;
      border: 1px solid #ccc;
    }
  </style>
</head>
<body>

  <h1>Sigma.js with Graphology</h1>
  <div id="sigma-test"></div>

  <script>
    // Create a new Graphology graph
    const graph = new graphology.Graph();

    // Add nodes to the graph
    graph.addNode('n1', { label: 'Node 1', x: 0, y: 0, size: 10, color: '#FF0000' });
    graph.addNode('n2', { label: 'Node 2', x: 1, y: 1, size: 10, color: '#00FF00' });
    graph.addNode('n3', { label: 'Node 3', x: 2, y: 0, size: 10, color: '#FFFF00' });
    graph.addNode('n4', { label: 'Node 4', x: 1, y: -1, size: 10, color: '#00FFFF' });
    graph.addNode('n5', { label: 'Node 5', x: -1, y: -1, size: 10, color: '#FF00FF' });
    graph.addNode('n6', { label: 'Node 6', x: -1, y: 1, size: 10, color: '#0000FF' });

    // Add edges to the graph
    graph.addEdge('n1', 'n2', { color: '#cccccc' });
    graph.addEdge('n2', 'n3', { color: '#cccccc' });
    graph.addEdge('n3', 'n4', { color: '#cccccc' });
    graph.addEdge('n4', 'n5', { color: '#cccccc' });
    graph.addEdge('n5', 'n1', { color: '#cccccc' });
    graph.addEdge('n1', 'n6', { color: '#cccccc' });
    graph.addEdge('n6', 'n3', { color: '#cccccc' });
    graph.addEdge('n2', 'n4', { color: '#cccccc' });

    // Initialize Sigma.js with the Graphology graph
    const container = document.getElementById('sigma-test');
    const renderer = new sigma(container, graph);

    // Render the graph
    console.log('Graphology + Sigma.js integration is working!');
  </script>

</body>
</html>
Message has been deleted

Timothy Hanson

unread,
Jan 28, 2025, 8:03:11 AMJan 28
to Google Apps Script Community
I switched to D3.js, and this is working great.
Reply all
Reply to author
Forward
0 new messages