function fetchDataset(url, cb, crop) {
var http = new XMLHttpRequest();
http.open("GET", url);
http.send();
http.onload = function () {
var result = http.responseText && JSON.parse(http.responseText);
cb && result && cb(result, crop);
};
};
function showData(res){
console.log(res);
var data = res.result[0].data.TELLUSCHIN;
var data = res && res.result && res.result[0] && res.result[0].data && res.result[0].data.TELLUSCHIN || []
var data = _get(res, 'result[0].data.TELLUSCHIN', [])
var mySeries = {
name: 'drewSeries',
data: data
}
myChart.addSeries(mySeries)
myChart.redraw()
};
fetchDataset('https://api.kernel.telluslabs.com/api/v1/metrics/?country_iso=USA&geo_level=level_1&data_points=3&metric_code=TELLUSCHIN,TLCHIN5YMN,TLCHIN5YLO,TLCHIN5YHI&api_key=80bcc60a8affd75375870d340463051e&geo_id=00&crop=corn', showData)