简体   繁体   中英

X axis title cutting off

I tried playing with the SVG dimensions but the text is cutting off.

jsFiddle

Code for X-axis:

svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.append("text")
.attr("x", width / 2 )
.attr("y", margin.bottom + 5)
.style("text-anchor", "middle")
.style("font-size", "150%")
.text("Age in Years");

How do I fix this?

Tried by increasing the margin bottom variable defined.

But that didn't work.

When i added +10 in this line .attr("height", height + margin.top + margin.bottom + 10) .

It's displaying fine now.

fiddle .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM