Commit f099c5b3 authored by Mikaël Salson's avatar Mikaël Salson Committed by Mathieu Giraud

browser/js: Make circle and bar IDs unique

The previous IDs may have not been unique when having
several scatterplots at once.
parent 0c2ad6b8
......@@ -509,7 +509,7 @@ Report.prototype = {
svg_sp.setAttribute("viewBox","0 0 791 250");
for (var i = 0; i < this.m.clones.length; i++) {
var circle = svg_sp.querySelectorAll('[id="circle'+i+'"]')[0]
var circle = svg_sp.querySelectorAll('[id="'+sp.id+'_circle'+i+'"]')[0]
var color = this.m.tag[this.m.clone(i).getTag()].color
circle.setAttribute("stroke", color);
......
......@@ -306,7 +306,7 @@ ScatterPlot.prototype = {
this.plot_container.selectAll("circle")
.attr("stroke", "")
.attr("id", function(d) {
return "circle" + d.id;
return self.id + "_circle" + d.id;
})
//Attribution de l'activité des cercles (inactif, sélectionné, demande d'info ou autre)
.attr("class", function(p) {
......@@ -529,7 +529,7 @@ ScatterPlot.prototype = {
.remove()
this.bar_container.selectAll("rect")
.attr("id", function(d) {
return "bar" + d.id;
return self.id + "_bar" + d.id;
})
//use clone circle position to init the clone bar position
......@@ -762,7 +762,7 @@ ScatterPlot.prototype = {
.transition()
.duration(speed)
.attr("id", function(d) {
return "bar" + d.id;
return self.id + "_bar" + d.id;
})
.attr("width", function(d) { return d.bar_w*self.gridSizeW })
.attr("x", function(d) { return (d.bar_x - d.bar_w/2)*self.gridSizeW + self.margin[3] })
......
......@@ -68,10 +68,10 @@ class VidjilBrowser < Watir::Browser
# Return the clone on the scatterplot
# Beware the id must be a string
def clone_in_scatterplot(id, extra={})
circle = element(extra.merge(:id => "circle"+id))
def clone_in_scatterplot(id, extra={}, number=1)
circle = element(extra.merge(:id => scatterplot_id(number) + "_circle"+id))
if circle.exists? and not circle.visible?
bar = element(extra.merge(:id => "bar"+id))
bar = element(extra.merge(:id => scatterplot_id(number) + "_bar"+id))
if bar.exists? and bar.visible?
return bar
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment