RhoInc/Webcharts

Falsey values in a numeric variable shouldn't be imputed to 0

Closed this issue · 4 comments

Right now "" is being drawn as a 0 - it should probably be null instead.

Test notes

  • Verify that missing values such as an empty string (Chrome, FireFox) or a series of one or more spaces (IE) are not coerced to 0, i.e. that they are not plotted at all.
  • Open the config-tester, select a scatter plot chart configuration, and set the Webcharts branch to master.
  • Click Render Chart then in the Data Preview delete the contents of various cells whose values are plotted in the chart. Note how the chart updates these points to plot at 0.
  • Change the Webcharts branch to falsey-zeroes and verify that these points are removed. Again delete the contents of various cells and verify that these point are removed rather than plotted at 0.

Issue is here. Leaning towards changing it to something like this: (+f[config.x.column] || +f[config.x.column] === 0) & ["",null,undefined,NaN,false].indexOf(f[config.x.column])==-1

Saving this for larger data flow refactor (currently scheduled for v1.12.0). Downgrading "log" axis-type to experimental in v1.8.0.

went with !(isNaN(value) || /^\s*$/.test(value))

Used this commit https://cdn.rawgit.com/RhoInc/webcharts-tests/9416446696f904cfe6f44f20bba3d0a1a90d3896/config-tester/test-page/index.html

In FF and Chrome this is working as expected. Used the data point versicolor 2.2/6.2 and when I deleted 6.2 off the Master branch, it shifted to the 0 x axis marker. When the rbanch is falsey-zeroes the point is just deleted.

In IE I followed the same steps except I added the space after deleting the data. Results were as expected, the marker zeroed out to the X axis and then disappeared when the branch was falsey-zeroes.