2017-07-07 114 views
0

這裏是我的腳本:d3.js x軸的長度太短

<script type="text/javascript"> 

有沒有一種方法來擴展x軸那麼一點點接觸到y軸的? 我試着玩弄某些值,但它會改變圖表的其餘部分,這是我不想要的。

enter image description here

回答

0

我想你已經迫使它在你的這部分代碼在翻譯×20個像素:

svg.append("g") 
    .attr("class", "x axis") 
    .attr("transform", "translate(20," + height + ")") /* <-- here! make it 0 , height */ 
    .call(xAxis); 
+0

是的,問題是,它仍然是這樣。 http://i.imgur.com/1UZN5vg.png我可以將文字移動一點嗎? – crystyxn

+0

我決定把它改爲-6,並稱它爲一天,謝謝 – crystyxn

+1

hehe ok :)我認爲,因爲你的Y軸有近6個像素的厚度,那麼你需要-6的X .. – Fered