Search code examples
javascriptjquerymorris.js

How to bring segments in morris.js bar chart close to each other?


How do you bring segments in morris.js bar chart close to each other? Below, the left one is what morris.js offers by default, but I would like to have the one on the right where segments are close to each other. The documentation doesn't specify such option. Do you know how I can achieve this?

this this


Solution

  • According to the source of Morris.js, you can use the option barGap. Its default value is 3, you can try with a lower value. Also you can use the option barSizeRatio (default value: 0.75) in order to adjust width between 2 rows of data.