Skip to content
Advertisement

How to add custom values to nodes of plotly graph

I’m trying to add values to nodes of plotly graph but there is an issue.

Code:

JavaScript

var values = nodes[nodeIndex].value; is not able to access the node values.

Suggestions on how to fix this will be really helpful.

EDIT0:

JavaScript

I made the corrections suggested in the answer below but the I am still not able to see the line graph when nodes in the main panel are clicked.

Advertisement

Answer

Use pointNumber instead of pointIndex. You also need to fix the type of the second plot, for which I also suggest to set a fixed axis range (otherwise the axis will reset for each selected point) :

JavaScript

For reference, here is the event data structure for 3d plots :

JavaScript

One last thing, don’t use plotly-latest.js or its minified version anymore. While still referenced here and there in the documentation, they are stuck at version 1.58.5.

Please note that as of v2 the “plotly-latest” outputs will no longer be updated on the CDN, and will stay at the last v1 patch v1.58.5. Therefore, to use the CDN with plotly.js v2 and higher, you must specify an exact plotly.js version.


Here is the complete code :

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement