Browse Source

Update getShapeOffset() to allow data series with unequal amount of x-values

Refs issue#1065
pull/1275/head
Amir 9 years ago
parent
commit
034fad22e9
  1. 19
      src/shape.js

19
src/shape.js

@ -41,8 +41,23 @@ c3_chart_internal_fn.getShapeOffset = function (typeFilter, indices, isSub) {
var values = $$.isStepType(d) ? $$.convertValuesToStep(t.values) : t.values;
if (t.id === d.id || indices[t.id] !== indices[d.id]) { return; }
if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id)) {
if (values[i].value * d.value >= 0) {
offset += scale(values[i].value) - y0;
// check if the x values line up
if (typeof values[i] === 'undefined' ||
(values[i].x !== d.x) && (values[i].x - d.x !== 0)) {
// if not, try to find the value that does line up
i = -1;
for (var j in values) {
if ((values[j].x === d.x) || (values[j].x - d.x === 0)) {
i = j;
break;
}
}
}
if (i in values) {
if (values[i].value * d.value >= 0) {
offset += scale(values[i].value) - y0;
}
}
}
});

Loading…
Cancel
Save