admin管理员组文章数量:1123048
I am trying to load sigma.js 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.
Here is the Google sheet I am using:
Edit: Here is the deploy link
This seems like it should work. Any insight on what is going on would be appreciated.
Thanks
<!-- Index.html -->
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<title>Sigma.js Graph</title>
<!-- Include sigma.js from CDN -->
<script src="/[email protected]/build/sigma.min.js"></script>
<style>
/* Style for the graph container */
#graph-container {
width: 100%;
height: 100%;
border: 1px solid #ccc;
}
</style>
</head>
<body>
<div id="graph-container"></div>
<script>
// Wait for the DOM to fully load
document.addEventListener('DOMContentLoaded', () => {
// Check if sigma is loaded
if (typeof sigma === 'undefined') {
console.error('Sigma.js is not loaded.');
return;
}
// Define your graph data
const graphData = {
nodes: [
{ id: 'n0', label: 'Node 0', x: 0, y: 0, size: 1, color: '#f00' },
{ id: 'n1', label: 'Node 1', x: 3, y: 1, size: 1, color: '#0f0' },
{ id: 'n2', label: 'Node 2', x: 1, y: 3, size: 1, color: '#00f' },
{ id: 'n3', label: 'Node 3', x: 4, y: 4, size: 1, color: '#ff0' }
],
edges: [
{ id: 'e0', source: 'n0', target: 'n1' },
{ id: 'e1', source: 'n1', target: 'n2' },
{ id: 'e2', source: 'n2', target: 'n3' },
{ id: 'e3', source: 'n3', target: 'n0' }
]
};
// Initialize sigma
const container = document.getElementById('graph-container');
const graph = {
nodes: graphData.nodes,
edges: graphData.edges
};
// Create a new sigma instance
const s = new sigma({
graph: graph,
container: container,
settings: {
defaultNodeColor: '#ec5148'
}
});
// Refresh to render the graph
s.refresh();
});
</script>
</body>
</html>
本文标签: Load sigmajs in a Google sheet HTML file give persistent error Sigmajs is not loadedStack Overflow
版权声明:本文标题:Load sigma.js in a Google sheet HTML file give persistent error Sigma.js is not loaded - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736542535a1944403.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论