Highchart: Generate Traffic Graph from JSON API - javascript

I'm trying to generate a Traffic Graph with Highchart from my JSON API.
Can someone help me to create the Javascript to create the graph from a json output like this:
[{"id":"1","upload":"767996","download":"3590994","timestamp":1459858309},{"id":"2","upload":"770635","download":"3594895","timestamp":1459858310},{"id":"3","upload":"796561","download":"3707508","timestamp":1459858337},{"id":"4","upload":"799858","download":"3710316","timestamp":1459858337},{"id":"5","upload":"801162","download":"3712063","timestamp":1459858338},{"id":"6","upload":"803541","download":"3713706","timestamp":1459858338},{"id":"7","upload":"805920","download":"3715373","timestamp":1459858338},{"id":"8","upload":"808421","download":"3716762","timestamp":1459858338},{"id":"9","upload":"809305","download":"3717695","timestamp":1459858338},{"id":"10","upload":"810381","download":"3718856","timestamp":1459858338}]
It's possbile to change the API output if it's needed.
Best regards
Leif

Related

Extracting Data from a Webpage

For my school project, I need the data on this website:
https://services2.hdb.gov.sg/web/fi10/emap.html
Specifically, I need the longitude and latitude, address, flat type and the number of units of the flat type in csv or excel format so that I can do some spatial analysis.
How do I create an automated process to get all the data from the website and not clicking all the individual buildings?
Appreciate any assistance on this. Thank you.
I got a look at the network traffic when this site is querying it's data. There you can find the XHR-Requests where also the streetname and other things are written down. You may use this to collect your data.

Export neo4j graph for a d3 visualisation

I am currently develloping a webservice to visualize neo4j graph on a html webpage. I use bolt driver to establish the connection with my database using javascript.
However even if I succeed to install "Apoc" plugin to export data to JSON format it's not d3 ready, furthemore I am not able to parse the data to a d3 format...
If anyone has any idea how I could retrieve a "nicer" format. like
[nodes{},
links{}]

Google Map s not working when using json data

I'm making a web app. I integrate GMap to know my client position. When I use it with manual number, the code is working. But when I use JSON data, the code is not working. The browser always run and my page can't right click.
This is my code.
You should parseInt('value') per lat and lng after separated them from json data

Pseudocode on pop up alert using bar chart data

I have a basic bar chart that retrieves data from my database and this data is stored into this chart on the front-end.
1) The data is not in an array
2) The data is not in a file
3) JSON.parse will not help in my particular situation
4) The data receives a JSON response via API and authentication
My question is, for web developers, in Javascript, how exactly do I go about developing that analysing a json request to find a certain number is over 10, as an example and for this particular situation.
No data is stored in the coding. But I imagine is there a way to read this data through the console using the javascript? If so, please point me to the right direction. Thanks!

Format data served from MySql via PHP PDO to feed Googe Charts on the Visualization API

I need to generate decision trees from a MYSQL v 5.6 table, queried with PHP PDO. I have a nice query which gives the data required, however I can't find the correct format to parse data to the Google API.
I searched and found a myriad of articles on how to format data to feed Google Charts. However the common denominator is the use of the infamous and deprecated mysql_query class to fetch data, and some addrow method which I found quite strange and UnClean.
I'm asking how should I format the json output in order to porperly feed the API. At the moment I query the data, json encode it using PHP's json_encode, and get the data properly via AJAX. Indeed my console shows that the data is properly read by the browser, however I know there is a format issue.
Unfortuantely tha google visualization API doesn't give me info on where the error could be. I just received this message:
Invalid format in explicit format: column #0 must be of type 'number'
Well this is a sample of data that the google javascript receives:
[{"id":"1","elemento":"CLIO","parent":"0","size":306}, {"id":"2","elemento":"LOGAN","parent":"0","size":431}, {"id":"3","elemento":"SANDERO","parent":"0","size":335},
On the other way, I'm following strictly the Google visualization guidelines to use data from external data sources:
Populating Data Using Server-Side Code
and specifically the chart that I need to render Wordtrees, which uses and arrayToDataTable method to format properly the data.
What should I correct in order to get and/or read the proper formatted json string of data? Please keep in mind the previous example of actual data which uses:
echo json_encode($data);
to JSON format the query output. Should I construct a table? How to do it in a proper, clean and modern way, not the mysql_query iteration.
Thanks for your time and collaboration.

Categories

Resources