Browse Source

Fix event rect for timeseries - #225

pull/246/head
Masayuki Tanaka 11 years ago
parent
commit
ff8b9de6dc
  1. 9
      c3.js
  2. 4
      c3.min.js

9
c3.js

@ -1367,7 +1367,8 @@
if (isCustomX || isTimeSeries) { if (isCustomX || isTimeSeries) {
// if included in input data // if included in input data
if (xs.indexOf(xKey) >= 0) { if (xs.indexOf(xKey) >= 0) {
c3.data.xs[id] = data.map(function (d) { return d[xKey]; }).filter(isValue); c3.data.xs[id] = data.map(function (d) { return d[xKey]; }).filter(isValue).map(function (rawX, i) { return generateTargetX(rawX, id, i); });
} }
// if not included in input data, find from preloaded data of other id's x // if not included in input data, find from preloaded data of other id's x
else if (__data_x) { else if (__data_x) {
@ -3537,14 +3538,14 @@
.selectAll('.' + CLASS.eventRect).remove(); .selectAll('.' + CLASS.eventRect).remove();
} }
if (isCustomX && !isCategorized) { if ((isCustomX || isTimeSeries) && !isCategorized) {
rectW = function (d, i) { rectW = function (d, i) {
var prevX = getPrevX(i), nextX = getNextX(i), dx = c3.data.xs[d.id][i]; var prevX = getPrevX(i), nextX = getNextX(i), dx = c3.data.xs[d.id][i];
return (x(nextX ? nextX : dx + 50) - x(prevX ? prevX : dx - 50)) / 2; return (x(nextX ? nextX : dx * 1.1) - x(prevX ? prevX : dx * 0.9)) / 2;
}; };
rectX = function (d, i) { rectX = function (d, i) {
var prevX = getPrevX(i), dx = c3.data.xs[d.id][i]; var prevX = getPrevX(i), dx = c3.data.xs[d.id][i];
return (x(dx) + x(prevX ? prevX : dx - 50)) / 2; return (x(dx) + x(prevX ? prevX : dx * 0.9)) / 2;
}; };
} else { } else {
rectW = getEventRectWidth(); rectW = getEventRectWidth();

4
c3.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save