|
|
@ -98,6 +98,8 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) { |
|
|
|
xs = $$.d3.keys(data[0]).filter($$.isX, $$), |
|
|
|
xs = $$.d3.keys(data[0]).filter($$.isX, $$), |
|
|
|
targets; |
|
|
|
targets; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$$.allDataIsNegative = true; |
|
|
|
|
|
|
|
|
|
|
|
// save x for update data by load when custom x and c3.x API
|
|
|
|
// save x for update data by load when custom x and c3.x API
|
|
|
|
ids.forEach(function (id) { |
|
|
|
ids.forEach(function (id) { |
|
|
|
var xKey = $$.getXKey(id); |
|
|
|
var xKey = $$.getXKey(id); |
|
|
@ -140,7 +142,9 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) { |
|
|
|
id: convertedId, |
|
|
|
id: convertedId, |
|
|
|
id_org: id, |
|
|
|
id_org: id, |
|
|
|
values: data.map(function (d, i) { |
|
|
|
values: data.map(function (d, i) { |
|
|
|
var xKey = $$.getXKey(id), rawX = d[xKey], x = $$.generateTargetX(rawX, id, i); |
|
|
|
var xKey = $$.getXKey(id), rawX = d[xKey], |
|
|
|
|
|
|
|
x = $$.generateTargetX(rawX, id, i), |
|
|
|
|
|
|
|
value = d[id] !== null && !isNaN(d[id]) ? +d[id] : null; |
|
|
|
// use x as categories if custom x and categorized
|
|
|
|
// use x as categories if custom x and categorized
|
|
|
|
if ($$.isCustomX() && $$.isCategorized() && index === 0 && rawX) { |
|
|
|
if ($$.isCustomX() && $$.isCategorized() && index === 0 && rawX) { |
|
|
|
if (i === 0) { config.axis_x_categories = []; } |
|
|
|
if (i === 0) { config.axis_x_categories = []; } |
|
|
@ -150,7 +154,12 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) { |
|
|
|
if (isUndefined(d[id]) || $$.data.xs[id].length <= i) { |
|
|
|
if (isUndefined(d[id]) || $$.data.xs[id].length <= i) { |
|
|
|
x = undefined; |
|
|
|
x = undefined; |
|
|
|
} |
|
|
|
} |
|
|
|
return {x: x, value: d[id] !== null && !isNaN(d[id]) ? +d[id] : null, id: convertedId}; |
|
|
|
|
|
|
|
|
|
|
|
if(value > 0) { |
|
|
|
|
|
|
|
$$.allDataIsNegative = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {x: x, value: value, id: convertedId}; |
|
|
|
}).filter(function (v) { return isDefined(v.x); }) |
|
|
|
}).filter(function (v) { return isDefined(v.x); }) |
|
|
|
}; |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|