From 6f3deac4af3d5928060e4a38f2de790d0544b79d Mon Sep 17 00:00:00 2001 From: Jason Frazier Date: Fri, 21 Aug 2015 15:21:30 -0700 Subject: [PATCH] IE9 CSV loading fix (#1345) * Fixes error parsing csv from xhr request callback object * Fixes error in IE9 when parsing csv files. IE9 doesn't support response param of xhr callback object. Copy responseText param to response param fixed the issue. Charts now render correctly. --- src/data.convert.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/data.convert.js b/src/data.convert.js index 00853f6..8b66354 100644 --- a/src/data.convert.js +++ b/src/data.convert.js @@ -11,15 +11,16 @@ c3_chart_internal_fn.convertUrlToData = function (url, mimeType, headers, keys, } req.get(function (error, data) { var d; + var dataResponse = data.response || data.responseText; // Fixes IE9 XHR issue; see #1345 if (!data) { throw new Error(error.responseURL + ' ' + error.status + ' (' + error.statusText + ')'); } if (type === 'json') { - d = $$.convertJsonToData(JSON.parse(data.response), keys); + d = $$.convertJsonToData(JSON.parse(dataResponse), keys); } else if (type === 'tsv') { - d = $$.convertTsvToData(data.response); + d = $$.convertTsvToData(dataResponse); } else { - d = $$.convertCsvToData(data.response); + d = $$.convertCsvToData(dataResponse); } done.call($$, d); });