Netlight hackathon project
I joined a Netlight hackathon and created an easy-to-use graph visualization.
My goal was to create something from scratch which could easily be used in simple single-file-projects without the need of any transpilation.
This is the result:
A minimal example:
<script src="OyvindGraph.js"></script>
<div id="graphExample"></div>
<script>
const graph = new OyvindGraph({
id: "graphExample",
width: "960",
height: "540",
});
const graphData = [1, 4, 1, 5, 9, 2, 6, 5, 3, 5];
graph.createGraph(graphData);
</script>
The example above is a minimal example. Nearly all aspects of the graph can be styled by supplying additional parameters.
Everything is created from scratch using HTML Canvas.
The viewport scales proportionally to the standard deviation of the graph, making sure that the graph is always somewhat contained within the viewport.