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*() 
<https://developers.google.com/chart/interactive/docs/reference#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:

   1. C2: "02/05/2021" 
   2. COLLECTOR_TS: "2021-02-05-20.16.01.916752" 
   3. COLLECTOR_VAR_DSC: "VVVVVV/BBBB" 
   4. ERR_CNT: 1 

 

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

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/0a1ca715-43e3-4839-9fd2-b7c01948db37n%40googlegroups.com.

Reply via email to