jquery.sparkline
jquery.sparkline copied to clipboard
Stacked bars does not support null
Love the stacked bars feature, but it would be great if it could support null values like the regular bar chart. Right now it seems null values are interpreted as 0, so there are thin lines being displayed at the bottom of a stacked bar (or at the top) where there should be none.
Here is the jsfiddle http://jsfiddle.net/vVyed/
Thanks
Encountering the same issue here! +1 :)
For anybody else who comes across this issue, I was able to accomplish a workaround by using an additional data series. I set the first color of the stacked colors option to what I would have used for 'nullColor', and then I insert 0s strategically in the data set to get it to display correctly. I can't say I understand 100% of the algorithm for when zeros vs. nulls are needed, but it does seem that for "completely null" entries, a value array containing a single 0 ([0]) works best... not an array of length (number of series + 1). In various other data entries, you may need to substitute 0 vs. null to prevent thin bars of undesired colors from appearing. Tooltips might need to be overridden as well, to ensure your desired behavior, depending on where your data is null vs. 0.
Here is an updated jsfiddle showing how it can be tricked into displaying orange lines for null values:
http://jsfiddle.net/djroze/vVyed/31/
Hope this helps someone!