How to set custom bandwidth in NDV3.

I am trying to plot a vertical bar chart using nvd3 charts.

Problem: If a chart has one record, the strip width reaches 3/4 of the chart width.

Question: How to change the bandwidth on a discrete diagram?

Attach a chart, please guide me.

enter image description here

+7
source share
1 answer

If you look at the source here . You will see that the width of the rectangle is calculated based on the number of elements using a rangeBand . There seems to be no way to set the width of the rectangle, although the library API.

If you don't want to fix the library, you can create additional fake bars with null data and provide label formatting that returns an empty string if the value is zero, but that means zero is not a valid number in your dataset.

+8
source

All Articles