Maximum width for column in bar chart

后端 未结 6 1082
天命终不由人
天命终不由人 2021-02-14 09:35

I\'m looking for a way of limiting the column width in a chart, I\'m sure this ought to be relatively easy but I cant find a way of doing it.

I\'m populating a chart fro

6条回答
  •  我寻月下人不归
    2021-02-14 10:01

    The easiest way to achieve this is by changing the line

    .attr("width", x1.rangeBand()-2)
    

    to

    .attr("width", Math.min(x1.rangeBand()-2, 100))
    

    You might also want to adjust the starting position and/or padding.

提交回复
热议问题