In this chapter, we will review the different ways we can abstract D3.js code. We realize how the different encapsulations map to different API flavors. We will examine examples of those APIs in production-ready D3.js libraries, how do they look in the real world and their results.
Finally, we discuss the aspects to take into consideration when choosing the best API for your project and context.
Encapsulation in D3.js Code
As we discovered in the previous chapter, we need an abstraction to encapsulate our D3.js code. This abstraction should solve the problems we highlighted in the example ...