简体   繁体   中英

Y axis some text cut of in d3js bar chart

I have a bar chart with d3 which is https://jsfiddle.net/1e87abkz/

and to rotate the text I write

.selectAll("text")  
            .style("text-anchor", "end")            
            .attr("dx", "-.8em")
            .attr("dy", ".15em")
            .attr("transform","rotate(-65)")
            .style("font-size","15px");

but in bottom some text cut of 在此处输入图片说明 please suggest how to fix this to visible all text .

只需增加您的底部边距以腾出足够的空间(小提琴中的第65行):

var margin = { top: 20, right: 30, bottom: 120, left: 40 },

Increase the height of your svg to make it visible.

<svg id="graph" style="height:700px"></svg>

you can also make your svg responsive, see the questions below to do that.

Resize svg when window is resized in d3.js

Whats the best way to make a d3.js visualisation layout responsive?

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