2015-08-15 102 views
0

我在定位工具提示點時遇到問題。我使用了一個有序的X規模,我只是無法讓它工作...不知道如果我不得不改變我的數據結構或......任何洞察力將不勝感激。我已經包含下面D3.js折線圖 - 定位點

tooltip_container.selectAll("dot")  
    .data(dataset)   
    .enter().append("circle")        
    .attr("r", 5) 
    .attr("cx", function(d,i) { /* return x(d) ?? */})    
    .attr("cy", function(d,i) { /* return y(d) ?? */}) 

JS Fiddle link

回答

0

一個JS FIDDLE鏈接如果你想創建的所有行的提示你需要這個

tooltip_container.selectAll("dot")  
    .data(dataset)   
    .enter().append("circle")        
    .attr("r", 5) 
    .attr("cx", function(d,i) { return x(d.month) })    
    .attr("cy", function(d,i) { return y(d.undecided) }) 

tooltip_container.selectAll("dot")  
    .data(dataset)   
    .enter().append("circle")        
    .attr("r", 5) 
    .attr("cx", function(d,i) { return x(d.month) })    
    .attr("cy", function(d,i) { return y(d.yes) }) 

tooltip_container.selectAll("dot")  
    .data(dataset)   
    .enter().append("circle")        
    .attr("r", 5) 
    .attr("cx", function(d,i) { return x(d.month) })    
    .attr("cy", function(d,i) { return y(d.no) })