UNPKG

sigma

Version:

A JavaScript library dedicated to graph drawing.

52 lines (44 loc) 1.5 kB
<!doctype html><html><head><meta http-equiv="Content-type" content="text/html; charset=utf-8"/><title>Sigma.js - Basic Example</title><style>html, body { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; } #container { width: 100%; height: 100%; } #grid { position: absolute; top: 0; left: 0; z-index: 1000; width: 100%; height: 100%; pointer-events: none; }</style></head><body><div id="container"></div><div id="grid-container"><canvas id="grid"></canvas></div><script>function grid(w, h) { var canvas = document.getElementById('grid'); var d = { w: canvas.offsetWidth, h: canvas.offsetHeight }; canvas.setAttribute('width', d.w); canvas.setAttribute('height', d.h); var context = canvas.getContext('2d'); var i; for (i = 0; i < d.w; i += w) { context.beginPath(); context.strokeStyle = 'red'; context.moveTo(i, 0); context.lineTo(i, d.h); context.stroke(); } for (i = 0; i < d.h; i += h) { context.beginPath(); context.strokeStyle = 'red'; context.moveTo(0, i); context.lineTo(d.w, i); context.stroke(); } }</script><script src="commons.bundle.js"></script><script src="basic.bundle.js"></script></body></html>