|
|
|
@ -77,7 +77,7 @@
|
|
|
|
|
$$.initParams(); |
|
|
|
|
|
|
|
|
|
if (config.data_url) { |
|
|
|
|
$$.convertUrlToData(config.data_url, config.data_mimeType, config.data_keys, $$.initWithData); |
|
|
|
|
$$.convertUrlToData(config.data_url, config.data_mimeType, config.data_headers, config.data_keys, $$.initWithData); |
|
|
|
|
} |
|
|
|
|
else if (config.data_json) { |
|
|
|
|
$$.initWithData($$.convertJsonToData(config.data_json, config.data_keys)); |
|
|
|
@ -1109,6 +1109,7 @@
|
|
|
|
|
data_onselected: function () {}, |
|
|
|
|
data_onunselected: function () {}, |
|
|
|
|
data_url: undefined, |
|
|
|
|
data_headers: undefined, |
|
|
|
|
data_json: undefined, |
|
|
|
|
data_rows: undefined, |
|
|
|
|
data_columns: undefined, |
|
|
|
@ -2001,9 +2002,15 @@
|
|
|
|
|
return current; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
c3_chart_internal_fn.convertUrlToData = function (url, mimeType, keys, done) { |
|
|
|
|
c3_chart_internal_fn.convertUrlToData = function (url, mimeType, headers, keys, done) { |
|
|
|
|
var $$ = this, type = mimeType ? mimeType : 'csv'; |
|
|
|
|
$$.d3.xhr(url, function (error, data) { |
|
|
|
|
var req = $$.d3.xhr(url); |
|
|
|
|
if (headers) { |
|
|
|
|
Object.keys(headers).forEach(function (header) { |
|
|
|
|
req.header(header, headers[header]); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
req.get(function (error, data) { |
|
|
|
|
var d; |
|
|
|
|
if (!data) { |
|
|
|
|
throw new Error(error.responseURL + ' ' + error.status + ' (' + error.statusText + ')'); |
|
|
|
@ -2239,7 +2246,7 @@
|
|
|
|
|
$$.load($$.convertDataToTargets(args.data), args); |
|
|
|
|
} |
|
|
|
|
else if (args.url) { |
|
|
|
|
$$.convertUrlToData(args.url, args.mimeType, args.keys, function (data) { |
|
|
|
|
$$.convertUrlToData(args.url, args.mimeType, args.headers, args.keys, function (data) { |
|
|
|
|
$$.load($$.convertDataToTargets(data), args); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|