From 00f592335860e21ede6df3bab11df3e7522b5cb3 Mon Sep 17 00:00:00 2001 From: Don Naegely Date: Sun, 15 Nov 2015 15:26:59 -0800 Subject: [PATCH] Replace null values with empty strings Highcharts behavior is very unpredictable when using null values in data points so we replace nulls with empty strings. For a more detailed explanation, see https://github.com/chop-dbhi/cilantro/issues/773#issuecomment-156868662. Signed-off-by: Don Naegely --- src/js/cilantro/ui/charts/dist.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/js/cilantro/ui/charts/dist.js b/src/js/cilantro/ui/charts/dist.js index a9f15fc3..05fc1fea 100644 --- a/src/js/cilantro/ui/charts/dist.js +++ b/src/js/cilantro/ui/charts/dist.js @@ -108,13 +108,16 @@ define([ this.model.distribution(function(resp) { if (_this.isClosed) return; - // Convert it into the structure the chart renderer expects + // Convert it into the structure the chart renderer expects. + // Since highcharts has odd behavior when encountering nul` + // we replace null values with empty strings to make the + // highcharts behavior more predictable. var data = _.map(resp, function(item) { return { count: item.count, values: [{ label: item.label, - value: item.value + value: item.value === null ? '' : item.value }] }; });