I want to display two xAxis at the bottom of my graph, one placed above the other. Hence in order to have my axes at the bottom, I specified .orient('bottom')
on both x1Axis and x2Axis.
Moreover, I set the transform
property to translate(0, height)
as can be seen below:
svg.append("g")
.attr("class", "x1 axis")
.attr("transform", "translate(0," + height + ")")
.call(x1Axis);
for(var i = 0 ; i < x1domain.length; i++){
svg.append("g")
.attr("class", "x2 axis")
.attr("transform", "translate("+ (x1.rangeBand()*i*(1/(1-x1padding))+ x1(x1domain[0])) + "," + height + ")")
.call(x2Axis);
}
As expected, I ended up with both axes superposing like so:
Hence I modified x1Axis's transform property to translate(0, height-x)
to move the axis up a bit. No matter the value of x (attempted {x | 1 <= x <= 20 } ), I was surprised to always obtain the following result:
Hence my question is, how can I have both axes at the bottom and one above the other? The behaviour seems to be predefined to clipping to top or bottom.
Note: For the sake of this discussion, ignore the fact that I am printing several axes for my x2Axis.