Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var select = d3.select('#form1')
- .append('select')
- var options = select.selectAll('option')
- .data(data)
- .enter().append('option')
- .attr('class', function(d) { return 'option option' + d.id;})
- .attr('id', function(d) { return 'tankValue' + d.id;})
- .html(function(d) { return d.discrip; })
- .attr('class', function(d) { return ' tankItem tankItem' + d.id;})
- .attr('value',function(d,i) { return i; });
- var button = $(".tankItem");
- var gallery = $('.mark');
- for (var i = 0; i < button.length; i++) {
- (function(index) {
- button[index].onclick = function() {
- for (var i = 0; i < gallery.length; i++) {
- gallery[i].style.opacity = i === index ? 1 : 0;
- }
- }
- }(i));
- }
- function updateDay1() {
- d3.selectAll(".mark").remove();
- d3.csv("data/data.csv", function(error, data) {
- if (error) return alert("error");
- var marks = features.selectAll(".mark")
- .data(data)
- .enter()
- .append("image")
- .filter(function(d){ if (d.area == "black") {
- return d.graphic
- }
- })
- .attr('class', function(d) { return 'stagger mark mark' + d.id;})
- .attr('id',function(d,i) { return "feature-"+i; })
- .attr('width', 35)
- .attr('height', 10)
- .attr("xlink:href", function(d) {return d.graphic})
- .attr('x', function(d) {return projection([d.graphicLong,d.graphicLat])[0]})
- .attr('y', function(d) {return projection([d.graphicLong, d.graphicLat])[1]})
- .attr("cursor", "pointer")
- .on("mousedown", function(d) {
- div.transition()
- .duration(200)
- .style("opacity", .9);
- 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>")
- .style("left", (d3.event.pageX) + "px")
- .style("top", (d3.event.pageY - 300) + "px");
- })
- .attr("text-anchor", "middle")
- .append("features:title")
- .text(function(d) { return d.id; })
- });
- }
Add Comment
Please, Sign In to add comment