Summary

In this chapter, you learned about two different XHR techniques to load external data for the visualization: d3.xhr with D3.js and $http with AngularJS. If we include an already existing chart application in the AngularJS application, we can wrap the D3.js loading component into a service. In order to test this component, we need to write asynchronous unit tests.

If we write the visualization from scratch, we'd better implement the data loading technique with the $http module of Angular JS. This allows you to mock the behavior of $httpBackend and automatically serve data for specified routes. With this method, we can continue to write synchronous tests, which are more readable and expressive.

In the second part of this chapter, we parsed ...

Get Data Visualization with D3 and AngularJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.