Browse Source

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.
pull/2082/head
Jason Frazier 9 years ago committed by Ændrew Rininsland
parent
commit
6f3deac4af
No known key found for this signature in database
GPG Key ID: ADBCD4C867F9B2DA
  1. 7
      src/data.convert.js

7
src/data.convert.js

@ -11,15 +11,16 @@ c3_chart_internal_fn.convertUrlToData = function (url, mimeType, headers, keys,
} }
req.get(function (error, data) { req.get(function (error, data) {
var d; var d;
var dataResponse = data.response || data.responseText; // Fixes IE9 XHR issue; see #1345
if (!data) { if (!data) {
throw new Error(error.responseURL + ' ' + error.status + ' (' + error.statusText + ')'); throw new Error(error.responseURL + ' ' + error.status + ' (' + error.statusText + ')');
} }
if (type === 'json') { if (type === 'json') {
d = $$.convertJsonToData(JSON.parse(data.response), keys); d = $$.convertJsonToData(JSON.parse(dataResponse), keys);
} else if (type === 'tsv') { } else if (type === 'tsv') {
d = $$.convertTsvToData(data.response); d = $$.convertTsvToData(dataResponse);
} else { } else {
d = $$.convertCsvToData(data.response); d = $$.convertCsvToData(dataResponse);
} }
done.call($$, d); done.call($$, d);
}); });

Loading…
Cancel
Save