Search code examples
visualizationvis.jsvis.js-network

How to use vis.js with map


I am trying to build a network visualization with vis.js and display it on a map (similar to Geo-layout in Gephi). Do you happen to know if something already exists to achieve such goal? (I don't even need to use vis.js if you have suggestions)

So far I tried/thought of using mapbox but I abandoned the idea of a real map because it it turning out to be fairly complex.

I downgraded expectation to doing the following:

  • done: have an image of a map in the background and have some big nodes that I can position manually by tweaking the x and y position

I still need to do the following:

  • Make the small nodes automatically fall into place as if it was a forced layout.

The problem is that I need to disable physics if i need to manually set some positions... this of course stops the smaller nodes from being automatically positioned.

any hints on how to achieve this?

Thanks!


Solution

  • I ended doing the following, in options set the layout and physics. (for some reason, improved layout has to be false, it was a lucky guess)

    layout: {  improvedLayout: false }
    

    physics: { enabled: true}

    For the node, set a property called fixed:

    fixed: { x: true , y: true } 
    

    Here is the son of the node:

    {id: 1,  value: 2,  label: 'xx' , x: 320, y:170 ,  fixed: { x: true , y: true } }