williaster / data-ui

A collection of data-rich UI components 📈
https://williaster.github.io/data-ui/
MIT License
546 stars 69 forks source link

How to create a bar chart with bars of fixed width, regardless of the number of bars? #174

Closed okanji closed 5 years ago

okanji commented 5 years ago

Am trying to find a way have fixed bar widths for a bar chart. Currently this is my xScale, can I pass anything else to it that would fix the bar width?

xScale={{ type: 'band', paddingInner: 0.15 }}

williaster commented 5 years ago

Hey @okanji thanks for checking out @data-ui. This currently is not possible, the bar width is auto-computed based on

So you can back compute the size you want, and pass in the appropriate width/margin for the number of data points you have, but otherwise you cannot specify this. Most of the time users want bars to fit in the chart/be auto-computed.

okanji commented 5 years ago

Thanks for your quick and detailed response!