Pregunta

I am combining two d3 visualizations on one page and need help with the CSS. At this point they appear on top of one another and I am so frustrated. The two visualizations are these: http://bl.ocks.org/mbostock/3883245:

enter image description here

and http://bl.ocks.org/mbostock/4063269:

enter image description here

I've just combined the two index.html files at this point. Any pointers to how I should style so that they don't overlap would be much appreciated!

¿Fue útil?

Solución

http://jsfiddle.net/dcryan22/GUH4A/

d3.select('body')
.append('svg')
.attr('height', 100)
.attr('width', 100)
.append('rect')
.attr('fill', 'red')
.attr('height', 100)
.attr('width', 100);

d3.select('body')
.append('svg')
.attr('height', 100)
.attr('width', 100)
.append('rect')
.attr('fill', 'blue')
.attr('height', 100)
.attr('width', 100);

An SVG shouldn't be overlapping another SVG. The example above, shows 2 basic and separate SVGs in the same Body tag.

My guess is that you are somehow re-using the SVG canvas so that one renders on top of the other.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top