Browse Source

gh-1616 Fix categorical charts with value 0

pull/1675/head
Richard Kubina 9 years ago committed by Ændrew Rininsland
parent
commit
5c71ee7a9b
No known key found for this signature in database
GPG Key ID: ADBCD4C867F9B2DA
  1. 12
      src/data.convert.js

12
src/data.convert.js

@ -166,18 +166,10 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
var xKey = $$.getXKey(id), rawX = d[xKey], var xKey = $$.getXKey(id), rawX = d[xKey],
value = d[id] !== null && !isNaN(d[id]) ? +d[id] : null, x; value = d[id] !== null && !isNaN(d[id]) ? +d[id] : null, x;
// use x as categories if custom x and categorized // use x as categories if custom x and categorized
if ($$.isCustomX() && $$.isCategorized() && rawX) { if ($$.isCustomX() && $$.isCategorized() && index === 0 && !isUndefined(rawX)) {
if (index === 0 && i === 0) { if (i === 0) { config.axis_x_categories = []; }
config.axis_x_categories = [];
}
x = config.axis_x_categories.indexOf(rawX);
if (x === -1) {
x = config.axis_x_categories.length;
config.axis_x_categories.push(rawX); config.axis_x_categories.push(rawX);
} }
} else {
x = $$.generateTargetX(rawX, id, i);
}
// mark as x = undefined if value is undefined and filter to remove after mapped // mark as x = undefined if value is undefined and filter to remove after mapped
if (isUndefined(d[id]) || $$.data.xs[id].length <= i) { if (isUndefined(d[id]) || $$.data.xs[id].length <= i) {
x = undefined; x = undefined;

Loading…
Cancel
Save