Commit 0099bf28 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix NaN when undefined x for bar chart

parent 95b41afe
...@@ -740,9 +740,10 @@ ...@@ -740,9 +740,10 @@
} }
function getBarX(barW, barTargetsNum, barIndices, isSub) { function getBarX(barW, barTargetsNum, barIndices, isSub) {
var scale = isSub ? subX : x; var scale = isSub ? subX : x;
if (! barTargetsNum) { return function () { return 0; }; }
return function (d) { return function (d) {
var barIndex = d.id in barIndices ? barIndices[d.id] : 0; var barIndex = d.id in barIndices ? barIndices[d.id] : 0;
return scale(d.x) - barW * (barTargetsNum / 2 - barIndex); return d.x || d.x === 0 ? scale(d.x) - barW * (barTargetsNum / 2 - barIndex) : 0;
}; };
} }
function getBarY(barH, barIndices, zeroBased, isSub) { function getBarY(barH, barIndices, zeroBased, isSub) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment