You must be logged in to post your query.
Home › Forums › Chart Support › Simple chart and XMLHttpRequest query
I am struggling to get a simple graph to update from info sent m=by the server. Canyou please review and let me know what I need to do to fix the problem?
Can you kindly create sample project reproducing the issue and share it with us over Google-Drive or Onedrive along with sample data so that we can run it locally to understand the scenario better and help you out?
Project location lives here https://1drv.ms/u/s!AlhSUfM145axgakPSEyMbq4wtiSGoA?e=GnsSYi
The html.text file when modified is pasted into
which then makes the html arduino compatible, this is then placed into the arduino code lines 87-99.
The major issue is getting the dataAmps variable to plot on the graph. (See html.text line 109)
The issue might be with the format of the data being passed to the chart. Parsing it in the format accepted by CanvasJS Chart should work fine in your case. Please refer to this documentation page for step-to-step tutorial on fetching data from external source (JSON) & parsing it to the format accepted by CanvasJS before rendering chart.
Please refer to this article for more information on adding CanvasJS charts in Arduino. Also take a look at this Github-repository for complete code.
Thanks for that. Looks like you can’t give the chart an array directly, you must use a for loop to push it to the graph. I still cannot find a specific example that helps me. I almost got the graph to display data and no errors are generated, however my variables are null/empty.
I guess I need to know how to use getJSON for a local server, all the examples are using web based data whereas my data is presented by XMLHttpRequest.
Can you kindly share sample data that you are receiving from the service so that we can analyze it & help you in converting it to the format accepted by CanvasJS?
You must be logged in to reply to this topic. Login/Register