Browse Source

Fix bug for raw timeseries input again - #311

pull/329/head
Masayuki Tanaka 11 years ago
parent
commit
d7b7b0645c
  1. 18
      c3.js
  2. 2
      c3.min.js

18
c3.js

@ -1465,17 +1465,7 @@
function generateTargetX(rawX, id, index) {
var x;
if (isTimeSeries) {
if (rawX) {
if (typeof rawX === 'number') {
x = new Date(rawX);
} else if (rawX instanceof Date) {
x = rawX;
} else {
x = parseDate(rawX);
}
} else {
x = parseDate(getXValue(id, index));
}
x = rawX ? parseDate(rawX) : parseDate(getXValue(id, index));
}
else if (isCustomX() && !isCategorized) {
x = isValue(rawX) ? +rawX : getXValue(id, index);
@ -2293,11 +2283,15 @@
function parseDate(date) {
var parsedDate;
if (date instanceof Date) {
parsedDate = date;
} else {
try {
parsedDate = date instanceof Date ? new Date(date) : d3.time.format(__data_x_format).parse(date);
parsedDate = typeof date === 'number' ? new Date(date) : d3.time.format(__data_x_format).parse(date);
} catch (e) {
window.console.error("Failed to parse x '" + date + "' to Date with format " + __data_x_format);
}
}
return parsedDate;
}

2
c3.min.js vendored

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