What is the difference between D3 and jQuery?

前端 未结 7 869
挽巷
挽巷 2021-01-29 23:54

Referring to this example:

http://vallandingham.me/stepper_steps.html

it seems that the D3 and jQuery libraries are very similar in the sense that they both do D

7条回答
  •  情歌与酒
    2021-01-30 00:24

    Both can solve the same purpose of creating and manipulating a DOM (whether it be HTML or SVG). D3 surfaces an API that simplifies common tasks you would take when generating/manipulating a DOM based on data. It does this through it's native support for data binding via the data() function. In jQuery you would have to manually process the data and define how to bind to the data in order to generate a DOM. Because of this, your code becomes more procedural and harder to reason and follow. With D3, it's less steps/code and more declarative. D3 also provides some higher level functions that aid in generating data visualization in SVG. Functions like range(),domain(), and scale() make it easier to take data and plot them on a graph. Functions like axis() also make it easier to draw common UI elements you would expect in a chart/graph. There are many other higher-level api libraries that sit on top of D3 to aid in more complex visualizations of data including interactive behavior and animation.

提交回复
热议问题