Guest User

Untitled

a guest
Dec 18th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. var select = d3.select('#form1')
  2. .append('select')
  3. var options = select.selectAll('option')
  4. .data(data)
  5. .enter().append('option')
  6. .attr('class', function(d) { return 'option option' + d.id;})
  7. .attr('id', function(d) { return 'tankValue' + d.id;})
  8. .html(function(d) { return d.discrip; })
  9. .attr('class', function(d) { return ' tankItem tankItem' + d.id;})
  10. .attr('value',function(d,i) { return i; });
  11.  
  12. var button = $(".tankItem");
  13. var gallery = $('.mark');
  14. for (var i = 0; i < button.length; i++) {
  15. (function(index) {
  16. button[index].onclick = function() {
  17. for (var i = 0; i < gallery.length; i++) {
  18. gallery[i].style.opacity = i === index ? 1 : 0;
  19. }
  20. }
  21. }(i));
  22. }
  23.  
  24. function updateDay1() {
  25. d3.selectAll(".mark").remove();
  26.  
  27. d3.csv("data/data.csv", function(error, data) {
  28. if (error) return alert("error");
  29. var marks = features.selectAll(".mark")
  30. .data(data)
  31. .enter()
  32. .append("image")
  33. .filter(function(d){ if (d.area == "black") {
  34. return d.graphic
  35. }
  36. })
  37. .attr('class', function(d) { return 'stagger mark mark' + d.id;})
  38. .attr('id',function(d,i) { return "feature-"+i; })
  39. .attr('width', 35)
  40. .attr('height', 10)
  41. .attr("xlink:href", function(d) {return d.graphic})
  42. .attr('x', function(d) {return projection([d.graphicLong,d.graphicLat])[0]})
  43. .attr('y', function(d) {return projection([d.graphicLong, d.graphicLat])[1]})
  44. .attr("cursor", "pointer")
  45. .on("mousedown", function(d) {
  46. div.transition()
  47. .duration(200)
  48. .style("opacity", .9);
  49. div.html("<div class='tipClose'><img src='graphic/closeBtn.svg' alt='Close Icon'></div><strong>Equipment Type:</strong> <br><span style ='color:red'>" + d.discrip+ "</span></br><a class='fancybox-thumb fancybox-button iframe fancybox' rel='fancybox-button' rel='fancybox-thumb' data-fancybox-group='"+d.clusterGrp +"' title='" + d.imageTitle+ " ' href='graphic/"+d.popup + "' ><img src='graphic/" + d.popupThumb + "' alt='Image'></a>")
  50. .style("left", (d3.event.pageX) + "px")
  51. .style("top", (d3.event.pageY - 300) + "px");
  52. })
  53. .attr("text-anchor", "middle")
  54. .append("features:title")
  55. .text(function(d) { return d.id; })
  56. });
  57. }
Add Comment
Please, Sign In to add comment