JSON loading

Graphs
Ogma
Visualization

We have been into graph visualization consulting for decades and yFiles captured a lot of our projects. Still, there are apps and visions where yFiles is overkill or too demanding. When it comes to data visualization there is nothing easier and more direct than Ogma. That is, if you don’t need sophisticated layout or editing of data then Ogma is what you need.

The example below would take a ton of code in yFiles and would do the job just as well, but the simplicity of this snippet with Ogma is hard to beat.

async function go(){

    const ogma = new Ogma({
    container: 'host',
    options:{
        backgroundColor: "transparent"
    }
    });
    let data = await FileAttachment("/data/solarCity.json").json();
    data = JSON.stringify(data);
 
    return Ogma.parse
    .json(data)
    .then(graph => ogma.setGraph(graph))
    .then(() => ogma.view.locateGraph())    
}
go();