Question:
How can I feed the output of my rest API into my Google Chart ? I've tried several methods jsonParse string etc.
The data has no header so I would like to 1) add header info
2) loop thu , or add directly via arrayToDataTable() or some other mechanism to populate the data directly to the chart directly from my Rest api.
Any help will be greatly appreciated.
var myurl = 'https://xxxxxx.test.rest.api
var jqxhr = $.ajax({
url: myurl ,
type : "POST",
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache,
only-
dataType: 'json',
contentType: 'application/json',
// crossDomain: true,
credentials: 'include', // include, *same-origin, omit
redirect: 'follow', // manual, *follow, error
referrerPolicy: 'no-referrer', // no-referrer,
*no-referrer-when-dow
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json ; charset=utf-8',
'Authorization': 'Basic fkfl;sfk;lksfl;kfl;kj'
}
})
.done(function(data) {
console.log(data);
})
One row looks like this:
Console OP :
--------------------------------------------------------------------------------------
1. {ResultSet Output: Array(2479), StatusCode: 200, StatusDescription: "Execution Successful"}
1. ResultSet Output: Array(2479)
1. [0 … 99]
2. [100 … 199]
3. [200 … 299]
4. [300 … 399]
5. [400 … 499]
6. [500 … 599]
7. [600 … 699]
8. [700 … 799]
9. [800 … 899]
10. [900 … 999]
11. [1000 … 1099]
12. [1100 … 1199]
13. [1200 … 1299]
14. [1300 … 1399]
15. [1400 … 1499]
16. [1500 … 1599]
17. [1600 … 1699]
18. [1700 … 1799]
19. [1800 … 1899]
20. [1900 … 1999]
21. [2000 … 2099]
22. [2100 … 2199]
23. [2200 … 2299]
24. [2300 … 2399]
25. [2400 … 2478]
26. length: 2479
27. __proto__: Array(0)
2. StatusCode: 200
3. StatusDescription: "Execution Successful"
4. __proto__: Object