Search code examples
labelaxis-labelsvis.js

how do I programmatically invoke labels in vis.js?


From the docs, I am unable to determine how in vis.js (Graph3d, in particular) I can cause labels to appear on my graphs dynamically.

I would like to modify the appearance of data for different sets of x, y and z; yet, it seems that vis.js favors the configuration of a graph's appearance prior to rendering.


Solution

  • Obtain the Graph3d object (maybe graph) and manipulate like so:

        var dataForLabeling = graph.dataPoints
        var someArbitraryPoint = dataForLabeling[2]
        graph._showTooltip(someArbitraryPoint)
    

    (Turns out the code for Graph3d is easy to read, like docs.)