Skip to content

Instantly share code, notes, and snippets.

@ghtmtt
Last active July 27, 2017 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghtmtt/aa30a7d65fe380c85ba4680a4b98e427 to your computer and use it in GitHub Desktop.
Save ghtmtt/aa30a7d65fe380c85ba4680a4b98e427 to your computer and use it in GitHub Desktop.
<head><meta charset="utf-8" /><script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head><div id="myDiv" style="height: 100%; width: 100%;" class="plotly-graph-div"></div><script type="text/javascript">window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("myDiv", [{"type": "scatter", "x": [6.81, 6.78, 6.49, 6.72, 6.88, 7.68, 7.69, 7.38, 6.76, 6.84, 6.91, 6.74, 6.77, 6.73, 6.68, 6.94, 6.72], "y": [1046.67, 1315.0, 1418.0, 997.33, 2972.3, 9700.0, 6726.0, 6002.5, 2096.0, 2470.0, 867.0, 2201.7, 1685.6, 2416.7, 1618.3, 2410.0, 2962.0], "mode": "markers", "ids": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]}], {"showlegend": true}, {"linkText": "Export to plot.ly", "showLink": false})</script>
<script>
var plotly_div = document.getElementById('myDiv')
var plotly_data = plotly_div.data
plotly_div.on('plotly_selected', function(data){
featureId = plotly_data[0].ids[data.points[0].pointNumber]
featureIds = []
data.points.forEach(function(pt) {
featureIds.push(parseInt(pt.id))
})
console.log(featureIds)
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment