Search code examples
zingchart

ZingChart: Stacked bar chart with series of null values


I'm creating a stacked bar chart with ZingChart. Assuming I am viewing daily data, each day shows 2 bars which are stacks of 5 values each.

According to the documentation, ZingChart should be capable of handling null values. However, if the first array of values in the series object is composed entirely of null values, the chart completely breaks and nothing appears on the canvas. Replacing even one of the null values with another value (including 0) will render the chart perfectly.

Here is an example CodePen:

https://codepen.io/Leandri/pen/NjVQaz

Try replacing one of the null values with another value, and the chart draws correctly. I have no idea what could be causing this and I'm thinking it must be a ZingChart bug. Please help!


Solution

  • Definitely a ZingChart bug.

    If the FIRST series.values array has no length or all null values, combined with stacked bars and the stack attribute. The chart will not render. There is an obvious workaround for now.

    1. Remove the first series object itself since its essentially doing nothing anyways. You can dynamically add the series using the API if you need it. This seems the most plausible.

    2. Place a single 0 value inside the array for it to render.

    This is not a high priority bug and has been pushed into our internal ticketing system.