You must be logged in to post your query.
Home › Forums › Chart Support › Progress Indicator for an AJAX Request?
Tagged: AJAX data loader bidimensional array
It is possible to have a progress indicator while the data are loading from an external AJAX data in file PHP?
Thanks, Marco
Marco,
Please take a look at this JSFiddle.
— Vishwas R Team CanvasJS
Pefect, thanks! Do you have also an example of import of external AJAX data for a RANGE BAR chart?
I have to import LABEL and COLOR fields: dataPoints.push({label: value[0], x: value[1], y: value[2], color: value[3]});
and value[2] is an array of timestamp: [ [‘ONLINE’,1,[1609427388000,1609427389000],’rgba(83, 223, 128, .1)’], [‘ONLINE’,1,[1606843031000,1607672648000],’rgba(83, 223, 128, .8)’], [‘ONLINE’,1,[1607672660000,1607685057000],’rgba(83, 223, 128, .8)’] ]
Marco
Parsing JSON to the format accepted by CanvasJS and passing it to chart-options should work fine. However, date-time over axisY is not possible as of now. which you can work-around it as shown in this JSFiddle.
If you are still facing any issue, kindly create JSFiddle reproducing the issue and share it with us so that we can look into it and help you out.
Dear Vishwas, I’ve created a working example in jsfiddle as you suggested.
I need to pass via externa Json file the rows: [ [‘ONLINE’,1,1610037371000,1610037372000,’rgba(83, 223, 128, .1)’], [‘ONLINE’,1,1607452607000,1607672648000,’rgba(83, 223, 128, .8)’], [‘ONLINE’,1,1607672660000,1607685057000,’rgba(83, 223, 128, .8)’], [‘ONLINE’,1,1607685669000,1607685832000,’rgba(83, 223, 128, .8)’], [‘ONLINE’,1,1607686070000,1607961179000,’rgba(83, 223, 128, .8)’] ]
I’m tring to use the code but doesn’t work:
$.getJSON(“datapoints.php”, function(data) { $.each(data, function(key, value){ var range = new Array(2); range.push([value[2],value[3]); // timestamp example: 1607686070000,1607961179000 dataPoints.push({label: value[0], x: value[1], y: range, color: value[4]}); }); chart.render(); });
Can you suggest me a solution?
Now I submit another test page with an array conversion jsfiddle
Please take a look at this updated JSFiddle which shows how to update data from external JSON.
You must be logged in to reply to this topic. Login/Register