From 5047173ccf62594058f18fbb0e516913de1d6b63 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 15 Aug 2013 19:02:22 +0900 Subject: [PATCH] Check timeseries column when load data --- c3.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 6608c9f..e465cf9 100644 --- a/c3.js +++ b/c3.js @@ -431,7 +431,12 @@ var targets, i = 0 data.forEach(function(d) { - d.x = (isTimeSeries) ? parseDate(d[__data_x]) : i++ + if (isTimeSeries) { + if (!(__data_x in d)) throw Error("'" + __data_x + "' must be included in data"); + d.x = parseDate(d[__data_x]); + } else { + d.x = i++; + } if (firstDate === null) firstDate = new Date(d.x) lastDate = new Date(d.x) })