Loading Data From Server
  Duration: 10:36
Part of Course: Introductory D3 Course
This Lesson is for subscribers

Loading-data-from-server_280x158
Unlock this lesson NOW!
  • Get expert advice on Loading Data From Server
  • Enjoy access to the complete DashingD3js catalog
  • Start mastering D3.js right now!

Takeaways:

  • The Python module SimpleHTTPServer defines a very simple HTTP server in the directory in which the command line command is run
  • If the SimpleHTTPServer finds an index.html file in the folder it is run in, then it serves that, otherwise it returns the directory structure of the folder
  • D3 includes an XHR module, d3.xhr, that creates an asynchronous request for the URL passed into it and has an option to take in a mimType and a JavaScript Callback Function
  • On top of the D3 XHR module site several kinds of type-specific XHR calls that allow for requesting and parsing of specific data
  • The D3 Type-Specific XHR Requests are d3.text, d3.json, d3.xml, d3.html, d3.csv, and d3.tsv
  • The D3 XHR Requests need a URL where the data they are requesting lives
  • Depending on the D3 Type-Specific XHR Requests used, the data will be sent for, received, and then parsed into an array of JavaScript Objects
  • For safety, D3 converts all numerical values received from the XHR request into strings
  • If an error occurs in the D3 XHR Requests, then the XMLHttpRequest Object will describe in great detail what error it encountered and the data argument will be returned as undefined

This Transcript is for subscribers.

Loading-data-from-server_280x158
Unlock this D3 Tutorial NOW!
  • Get expert advice on Loading Data From Server
  • Enjoy access to the complete DashingD3js catalog
  • Start mastering D3.js right now!
<< Back To D3 Screencast and Written Tutorials Index