All examples By author By category About


Letter Frequency

D3 2.10 adds support for optional outer padding with d3.scale.ordinal. This parameter allows you to control the outer padding (before the first bar and after the last bar) separately from the inner padding between bars. In this case, the inner padding is 10% and the outer padding is 20%.

var x = d3.scale.ordinal()
    .rangeRoundBands([0, width], 0.1, 0.2);

See also this updated version with an axis title.