Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. var point = data.points[0].x;
  2. var counter = 0;
  3. $(".menuOption").click(function () {
  4. console.log(counter);
  5. counter++;
  6. var code = $(this).attr('id');
  7. var text = $(this).html();
  8. var newLine = {
  9. type: 'line',
  10. x0: point,
  11. x1: point,
  12. y0: 0,
  13. y1: 1,
  14. yref: 'paper',
  15. line: {
  16. color: 'black',
  17. width: 1
  18. },
  19. name: text
  20. };
  21. var annotation = {
  22. x: point,
  23. y: data.points[0].y,
  24. xref: 'x',
  25. yref: 'y',
  26. text: code,
  27. textangle: 90,
  28. showarrow: true,
  29. arrowhead: 7
  30. }
  31. Plotly.relayout("grap", {
  32. 'shapes[0]': newLine,
  33. 'hovermode': 'closest',
  34. 'annotations[0]': annotation
  35. });
  36.  
  37. });
  38.  
  39. https://codepen.io/dmance/pen/mMdXqG
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement