- Expert Data Visualization
- Jos Dirksen
- 191字
- 2021-07-09 18:22:40
How does D3 work?
At this point, you should have a working environment, so let's start by looking at some code and see if we can get D3 up and running. As we've mentioned at the beginning of this chapter, D3 is most often used to create and manipulate SVG elements using a data-driven approach. SVG elements can represent shapes, lines, and also allow for grouping. If you need a reference to check what attributes are available for a specific SVG element, the Mozilla Developer Network also has an excellent page on that: https://developer.mozilla.org/en-US/docs/Web/SVG.
In this section, we'll perform the following steps:
- Create and add an empty SVG group (g) element, to which we'll add our data elements.
- Use a JavaScript array that contains some sample data to add rectangles to the SVG element created in the previous step.
- Show how changes in the data can be used to update the drawn rectangles.
- Explain how to handle added and removed data elements using D3.
At the end of these steps, you should have a decent idea of how D3 binds data to elements, and how you can update the bound data.
推薦閱讀
- PWA入門與實(shí)踐
- Redis Applied Design Patterns
- Visual Basic程序設(shè)計(jì)教程
- Getting Started with CreateJS
- 實(shí)用防銹油配方與制備200例
- Linux環(huán)境編程:從應(yīng)用到內(nèi)核
- Learning SciPy for Numerical and Scientific Computing(Second Edition)
- NGINX Cookbook
- Service Mesh實(shí)戰(zhàn):基于Linkerd和Kubernetes的微服務(wù)實(shí)踐
- 鴻蒙OS應(yīng)用編程實(shí)戰(zhàn)
- Hands-On Neural Network Programming with C#
- Python 3 數(shù)據(jù)分析與機(jī)器學(xué)習(xí)實(shí)戰(zhàn)
- Software Architecture with Python
- 零基礎(chǔ)PHP從入門到精通
- 計(jì)算思維與Python編程