Search code examples
angularhoverbar-chartngx-charts

swimlane ngx-charts Angular 9, Enable vertical bar chart ability to show and hover over zero (0) values in v11.2.0+ (was available in v11.1.0)


It appears that between @swimlane/ngx-charts v11.1.0 and v11.2.0, the ability to display and hover over a vertical bar chart's 0 values was removed. Is it possible to re-enable the ability to see and hover over the bars with a value of 0 in v11.2.0+? (I'm running Angular 9 with ngx-charts v14, but v16 was just released).

Here is the exact same project, with only the ngx-charts version number changed.

Using ngx-charts v11.1.0 v11.1.0 allows hover over 0 values

Using ngx-charts v11.2.0 v12 does not allow for hover or display of 0 values

Thank you.


Solution

  • I misunderstood the implications of the added noBarWhenZero input flag in v11.2.0 as meaning the bar would not be shown at all (not even on the x axis) but instead the default value is true, and needs to be set to false if you want to see the bars that have the value of 0 again.

    The solution is to set [noBarWhenZero]="false" in the chart options.