morrisjs / morris.js

Pretty time-series line graphs
http://morrisjs.github.com/morris.js/
6.91k stars 1.23k forks source link

Show a bar for Zero results in a Morris.bar #744

Open SamFraser2007 opened 6 years ago

SamFraser2007 commented 6 years ago

Id like to show a bar for zero results in my bar chart, is there a way to do this? I asked the question on stack overflow but only got one response, recommending a different library that will do this: https://stackoverflow.com/questions/48097827/show-a-bar-for-zero-results-with-morris-js/48112328?noredirect=1#comment83204405_48112328

Heres a fiddle: https://jsfiddle.net/beaver71/zm8wt4pj/

I think this would be a nice feature for morris!

pierresh commented 6 years ago

That is a good idea, I just wrote a solution in Stackoverflow:

If you compile from coffee script files, just add after lastTop += size in morris.bar.coffee

if size == 0 then size = 1

Otherwise just add after lastTop += size; in morris.js:

if (size === 0) { size = 1; }

SamFraser2007 commented 6 years ago

Thank You, It would be nice to have as an option maybe? showZero: true or something like that