Browse Source

Fix event rect width when no data

pull/183/head
Masayuki Tanaka 11 years ago
parent
commit
89049f47cf
  1. 10
      c3.js
  2. 2
      c3.min.js

10
c3.js

@ -549,9 +549,13 @@
} }
function getEventRectWidth() { function getEventRectWidth() {
var target = getMaxDataCountTarget(c3.data.targets), var target = getMaxDataCountTarget(c3.data.targets),
firstData = target.values[0], lastData = target.values[target.values.length - 1], firstData, lastData, base, maxDataCount, ratio;
base = x(lastData.x) - x(firstData.x), if (!target) {
maxDataCount = getMaxDataCount(), return 0;
}
firstData = target.values[0], lastData = target.values[target.values.length - 1];
base = x(lastData.x) - x(firstData.x);
maxDataCount = getMaxDataCount();
ratio = (hasBarType(c3.data.targets) ? (maxDataCount - (isCategorized ? 0.25 : 1)) / maxDataCount : 1); ratio = (hasBarType(c3.data.targets) ? (maxDataCount - (isCategorized ? 0.25 : 1)) / maxDataCount : 1);
return maxDataCount > 1 ? (base * ratio) / (maxDataCount - 1) : base; return maxDataCount > 1 ? (base * ratio) / (maxDataCount - 1) : base;
} }

2
c3.min.js vendored

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