We may earn an affiliate commission when you visit our partners.
Course image
Elisabeth Robson

Welcome to How to Visualize Data with D3. In this project, join Elisabeth Robson to learn how to incorporate data visualization into your web skills using HTML, JavaScript and the D3 data visualization library. Elisabeth will take you through building a visualization using data downloaded from NASA. You'll learn how to use D3 to read data into a web page, select and create new elements, and position and style elements to generate a striking color visualization. Along the way you'll learn from the ground up how to use D3: how data binding works, how to use methods to add attributes and style on D3 elements, and how to use scale functions to process data points as you build the visualization.

Read more

Welcome to How to Visualize Data with D3. In this project, join Elisabeth Robson to learn how to incorporate data visualization into your web skills using HTML, JavaScript and the D3 data visualization library. Elisabeth will take you through building a visualization using data downloaded from NASA. You'll learn how to use D3 to read data into a web page, select and create new elements, and position and style elements to generate a striking color visualization. Along the way you'll learn from the ground up how to use D3: how data binding works, how to use methods to add attributes and style on D3 elements, and how to use scale functions to process data points as you build the visualization.

At the end of the course you'll have completed a data visualization of the NASA data, and have some new skills you can apply to your own data too.

Enroll now

What's inside

Syllabus

Get set up to create the Warming Stripes project

Welcome to How to Visualize Data with D3. In this project, join Elisabeth Robson to learn how to incorporate data visualization into your web skills using HTML, JavaScript and the D3 data visualization library. Elisabeth will take you through building a visualization using data downloaded from NASA. You'll learn how to use D3 to read data into a web page, select and create new elements, and position and style elements to generate a striking color visualization. Along the way you'll learn from the ground up how to use D3: how data binding works, how to use methods to add attributes and style on D3 elements, and how to use scale functions to process data points as you build the visualization.

At the end of the course you'll have completed a data visualization of the NASA data, and have some new skills you can apply to your own data too.

The inspiration for this course is the "Warming Stripes" visualization by climate scientist Ed Hawkins. You can follow him on twitter, or visit his blog to learn more about Ed and his work.

Pre-requisites

To successfully complete this project, we recommend that you have some background in HTML and JavaScript. You don't need to be an expert by any means, but you should have experience building web pages and you should have basic programming skills with JavaScript.

No experience with D3 is required.

Learning Path

  • Head First HTML and CSS (Chapters 1-6)

  • Head First JavaScript Programming (Chapters 1-6)

  • This course: How to Visualize Data with D3

Resources

You can download the completed code from GitHub here: https://github.com/bethrobson/CCC/tree/master/Stripes. We recommend, however, that you follow along starting from scratch to help with the learning process.

Read more

In this lesson, we look at some examples of visualizations, and talk about the key components of the visualization you'll be building.

It's time to take a closer look at the data so we understand the numbers we're working with before we visualize them. In this lesson we step through the data from NASA and explain what it means.

In this lesson you'll learn what you need to work on this project, including the data we'll be using to create the visualization.

Resources

Get the source data from NASA (CSV): https://data.giss.nasa.gov/gistemp/tabledata_v3/GLB.Ts.csv

Get the source data from Github: https://github.com/bethrobson/CCC/blob/master/Stripes/GLB.Ts.csv

Get the code files from Github: https://github.com/bethrobson/CCC/tree/master/Stripes

Get the link from D3 (we'll link directly to D3, but you can download the code if you want and link to it on your computer. We'll do this step in the lesson "Build the HTML"): https://d3js.org/

In this lesson, you'll create all the HTML we'll need for this project (not a lot!) and link to the D3 library at https://d3js.org/.

In this lesson, you'll learn how to use D3 to read CSV data from the data file. We'll step through how to process each line of data as it's read in from the file, and how to use the Promise object returned from the d3.csv method to work with the resulting data array in the code.

This is a long lesson but hang in there; at the end of the lesson you'll be reading data from the file and be ready to start working on turning the data into the visualization.

In a previous lesson you learned how we can read data from a CSV file using D3, creating an array of objects made out of each line of data in the CSV.

You also learned that D3 automatically uses the headings in the first row of the CSV file as the properties for each entry in the data (CSV is comma separated values, so each entry is separated by a comma on a line of data).

Write some D3 code to read in the attached file (Icecream.csv) and create an array of objects containing the ice cream data.

In this lesson you'll get an introduction to SVG and how to use D3 to generate SVG for a visualization. We'll write the code to generate the SVG element and add attributes to size it correctly for the visualization.

In this lesson, we'll talk about how you'll typically see D3 code written: using method chaining style. It's a good idea to get used to reading and using this style for programming D3. The D3 API was designed using the Fluent Interface Pattern which allows us to method chain most method calls in D3.

In this lesson, we'll create a SVG rectangle for each point in the data array. Each rectangle will be a color stripe in the final visualization. A key concept in D3 is data binding: that is binding data points in an array to elements you're creating and adding to a visualization. You'll learn how data binding in D3 works, and how to easily generate a SVG rectangle for each data point in our temperature anomaly data.

We are creating a SVG rectangle for every point in our data array. Those rectangles are going to need to be positioned, and sized, and styled correctly so they look like the color stripes in the final visualization.

In this exercise, you'll try writing code to make each rectangle the correct size. By default each rectangle is 0 pixels in width and 0 pixels in height.

It's time to size and position the rectangles we've created. In this lesson you'll learn how to use the D3 attr() method to set the width, height, and y position of the rectangles that we'll use to create the color stripes.

Don't forget that when we position elements in the browser, the top left corner of the browser is x, y position 0, 0. The x position increases as you move across the screen to the right, and the y position increases as you move down the screen from top to bottom. This is a little different from how you think about x, y axes normally (where y increases as you go up), so that's just something to keep in mind as you do this lesson.

If you want an attribute value of an SVG element to be based on information in the data point or its index in the data array, you need to get a handle to the data point somehow. In this lesson you'll learn how to do that with a function we pass to the attr() method. This is another key concept in D3 so spend time on this lesson and review it more than once if you need to!

We'll use an online color tool (colorbrewer2.org) to select colors for our visualization, and add these colors as an array of hex values. In this lesson you'll learn how to choose those colors, how to arrange them in an array, and learn the first steps of how to use the D3 style() method to set the "fill" property to assign a color to a data point.

In D3, when we want to convert a value in one set of values (known as the domain) to another set of values (known as the range), we write a scale function. We'll get into a lot more detail about writing a scale function for our temperature anomalies in the next few lessons; in the meantime, practice by doing this exercise to convert dog ages into human years, and human ages into dog years. It's often said that a dog ages 5 years for every human year.

Converting data points to numbers representing colors or position or size is a common problem when visualizing data and it's one that D3 has methods to help with. In this lesson you'll learn about domain and range and how to think about converting one set of values to another. In our case, we want to convert temperature anomalies to color. In this lesson you'll think through how we can do that.

In this lesson, you'll create a linear scale function to convert a temperature anomaly (in the domain), to an index in the color array (in the range). You'll learn how to use the D3 scaleLinear() function and its methods domain() and range() to map from temperature anomalies to indices we can use in the color array to pick a color. This is another key concept in D3 so take your time, and make sure you understand each step.

In this lesson we use the linear scale function we just created to style the stripes and complete the visualization. This is the last step! If all goes well you'll see the finished visualization once you complete this lesson, so hang in there, you're almost done.

In this final lesson we take another look at the visualization we've created and talk about what it shows us.

As a reminder, you can download the complete files from github, including the source data (originally from NASA).

To learn more D3, go to https://d3js.org/.

To learn more about climate change, go to https://climate.nasa.gov/.

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Uses D3, a powerful JavaScript library, to create dynamic and interactive data visualizations in web browsers, which is highly relevant to front-end web development
Visualizes NASA climate data, offering a practical application of data visualization techniques to a relevant and timely scientific topic
Teaches D3 from the ground up, covering data binding, attribute manipulation, styling, and scale functions, which builds a strong foundation for beginners
Recommends completing introductory HTML and JavaScript courses before starting, which may pose a barrier to learners without prior web development knowledge
Focuses on creating a specific visualization (warming stripes), which may not cover the breadth of D3's capabilities for other types of visualizations

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Project-based d3 introduction

According to learners, this course offers a practical, project-based introduction to D3.js by guiding you through building a real-world visualization project (Warming Stripes) using NASA data. Students say it provides a clear, step-by-step guide to using D3 for data binding, manipulating SVG elements, and applying scale functions. It covers core D3 concepts effectively within the context of the project. However, learners should note that it requires a prior foundation in HTML and JavaScript and is very focused on creating just one type of chart, so it may not provide broad coverage of D3 capabilities. The inclusion of practice exercises helps reinforce learning.
Needs prior experience with web development coding.
"Make sure you have a solid grasp of HTML and JavaScript; the course assumes you do."
"The pace might be challenging if you're a complete beginner to web programming."
"Prior coding experience, especially with JavaScript, is definitely a necessary prerequisite."
"Do the Work" sections offer hands-on coding.
"The 'Do the Work' sections really helped solidify the concepts right after learning them."
"I appreciated having coding exercises to practice what was taught in the lessons."
"It's helpful that solutions are provided for the practice exercises."
Key concepts like data binding and scales are introduced.
"The explanations on data binding, which is crucial for D3, were quite helpful."
"Understanding how to use scale functions to map data to visual properties was clearly explained."
"This course introduces fundamental D3 methods needed for basic visualizations."
Lessons build sequentially to complete the project.
"The course takes you through building the visualization piece by piece, which is easy to follow."
"Lessons follow a logical order from setting up the environment to styling the final output."
"It was easy to track my progress and see how each lesson contributed to the final project."
Learn D3 by building a real visualization project.
"I really liked building the Warming Stripes project step-by-step; it made D3 less abstract."
"Learning D3 while working on a practical project using real data felt much more engaging than just theory."
"The hands-on approach with the NASA data visualization was a great way to see D3 in action."
Primarily teaches creating a single visualization.
"While I liked the project, I wish it covered more different types of visualizations beyond just rectangles."
"The course is very focused on the specific 'Warming Stripes' example, which limits exposure to other D3 charts."
"It's a deep dive into one chart type rather than a broad introduction to D3's versatility."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in How to Visualize Data with D3 with these activities:
Review HTML and CSS Fundamentals
Reinforce your understanding of HTML and CSS, which are essential prerequisites for effectively using D3. This will make it easier to manipulate the DOM and style your visualizations.
Show steps
  • Review basic HTML structure and tags.
  • Practice CSS selectors, properties, and values.
  • Build a simple webpage using HTML and CSS.
Brush Up on JavaScript Basics
Strengthen your JavaScript skills, as D3 heavily relies on JavaScript for data manipulation and DOM interaction. A solid JavaScript foundation will enable you to write more efficient and understandable D3 code.
Browse courses on JavaScript
Show steps
  • Review JavaScript syntax, data types, and operators.
  • Practice working with functions, arrays, and objects.
  • Experiment with DOM manipulation using JavaScript.
Reading: Interactive Data Visualization for the Web
Study this book to gain a deeper understanding of D3 concepts and techniques. It will help you follow along with the course material and build more complex visualizations.
Show steps
  • Read the chapters on data binding and scales.
  • Experiment with the code examples provided in the book.
  • Try to apply the concepts to your own data.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Follow D3.js Tutorials on Observable
Work through interactive D3 tutorials on Observable to reinforce your understanding of specific concepts covered in the course. This provides hands-on experience and allows you to experiment with different D3 features.
Show steps
  • Find tutorials related to scales and axes.
  • Modify the code in the tutorials to see how it affects the visualization.
  • Create your own simple visualizations based on the tutorials.
Create a Simple Bar Chart with D3
Build a basic bar chart using D3 to solidify your understanding of data binding, scales, and DOM manipulation. This hands-on project will help you apply the concepts learned in the course.
Show steps
  • Choose a dataset for your bar chart.
  • Write D3 code to bind the data to SVG rectangles.
  • Use scales to position and size the bars.
  • Add axes to the bar chart.
Visualize Your Personal Data
Apply your D3 skills to visualize your own personal data, such as fitness tracking data, financial data, or social media activity. This will allow you to explore your data in a new way and create a unique visualization.
Show steps
  • Collect and clean your personal data.
  • Choose a visualization type that is appropriate for your data.
  • Write D3 code to create the visualization.
  • Add interactivity to the visualization.
Reading: D3.js in Action
Study this book to learn more advanced D3 techniques and build more sophisticated visualizations. It will help you expand your D3 skillset and create more engaging and informative visualizations.
Show steps
  • Read the chapters on animations and interactions.
  • Experiment with the code examples provided in the book.
  • Try to apply the concepts to your own projects.

Career center

Learners who complete How to Visualize Data with D3 will develop knowledge and skills that may be useful to these careers:
Data Visualization Specialist
A Data Visualization Specialist transforms raw data into compelling visual stories. This career involves using tools and techniques to present data in an accessible and insightful manner. The course, *How to Visualize Data with D3*, directly aligns with the responsibilities of a data visualization specialist, as it teaches how to use HTML, JavaScript, and the D3 data visualization library. The course helps build a foundation for reading data into a web page, selecting elements, and positioning them, all of which are essential skills for this role. By learning how to create striking color visualizations, you may develop the practical skills needed to excel as a Data Visualization Specialist.
Science Communicator
Science Communicators translate complex scientific information into accessible and engaging formats for the general public. This career often involves creating visuals to explain data and research findings. *How to Visualize Data with D3* may provide Science Communicators with the skills to create compelling and interactive data visualizations for websites and educational materials. The course's lessons on using HTML, JavaScript, and the D3 data visualization library may enable communicators to present scientific data in more understandable ways. The final project of the course involves visualizing data downloaded from NASA, a perfect fit for Science Communicators.
Front-End Developer
A Front End Developer is responsible for designing and implementing the user interface of websites and applications. This individual must create visually appealing and user-friendly experiences. The course, *How to Visualize Data with D3*, helps build a foundation for Front End Developers interested in incorporating data visualization into their projects. With the course's lessons on HTML, JavaScript, and the D3 data visualization library, you may gain the skills to integrate interactive data visualizations in web projects. Knowledge of data binding, adding attributes, and styling D3 elements are extremely relevant for a Front End Developer.
Data Storyteller
Data Storytellers weave narratives around data to communicate insights and drive action. This career requires a blend of analytical and creative skills. *How to Visualize Data with D3* may provide Data Storytellers with the technical skills to create compelling visual narratives. The course's lessons on using HTML, JavaScript, and the D3 data visualization library may enable storytellers to build interactive visualizations that engage audiences and convey key messages effectively. This is particularly useful in the course's lessons on styling D3 elements.
Data Analyst
Data Analysts interpret data to identify trends and insights that inform business decisions. While Data Analysts often use tools like Excel and SQL, the ability to create custom visualizations can significantly enhance their analytical capabilities. *How to Visualize Data with D3* may be particularly helpful for data analysts looking to present their findings more effectively. With the course's focus on using HTML, JavaScript, and the D3 data visualization library, you may learn to communicate complex data patterns through interactive visualizations, which sets you apart in the field. Learning how to read data, select elements, and style visualizations are all useful skills for a Data Analyst.
Web Developer
Web Developers create and maintain websites. This career requires a blend of technical skills and design sensibilities. Those looking to expand their capabilities in data visualization may find *How to Visualize Data with D3* helpful. The course's lessons on HTML, JavaScript, and the D3 data visualization library may enable Web Developers to add dynamic data driven graphics to websites. This course provides a hands-on approach to learning how to read data into a web page, create new elements, and style those elements using D3, skills that are directly applicable to web development projects.
Journalist
Journalists investigate and report on current events, often using data to support their stories. Data visualization skills are increasingly valuable in journalism for creating impactful and informative graphics. *How to Visualize Data with D3* may equip Journalists with the ability to create custom visualizations for their online articles. The course's lessons on using HTML, JavaScript, and the D3 data visualization library may enable journalists to present data in a clear and engaging manner. The skills acquired could set journalists apart.
User Interface Engineer
A User Interface Engineer focuses on the technical implementation of user interfaces, ensuring they are both functional and visually appealing. This role requires a strong understanding of front end technologies and design principles. *How to Visualize Data with D3* may be helpful for User Interface Engineers who wish to integrate data visualization into user interfaces. The course provides hands-on experience using HTML, JavaScript, and the D3 data visualization library to build interactive visualizations. UI Engineers may find the course valuable for learning how to bind data to elements, add attributes, and apply styles using D3.
Business Intelligence Analyst
Business Intelligence Analysts analyze market trends and provide actionable insights to improve business performance. This career often involves creating dashboards and reports to communicate findings to stakeholders. *How to Visualize Data with D3* may equip Business Intelligence Analysts with the skills to create more engaging and informative visualizations. By learning how to use HTML, JavaScript, and the D3 data visualization library, analysts may present data more effectively. In particular, the course's features on data binding and styling may be very useful.
Data Scientist
Data Scientists use statistical methods and machine learning techniques to extract knowledge and insights from data. Data visualization is a crucial part of communicating findings and exploring data. While Data Scientists commonly use Python and R for visualization, *How to Visualize Data with D3* may provide a complementary skillset for creating interactive web based visualizations. The course may be particularly beneficial for learning how to present complex data sets using HTML, JavaScript, and the D3 data visualization library. The acquired skills may be most useful when communicating data to stakeholders through web applications.
Researcher
Researchers conduct studies and experiments to advance knowledge in a particular field. Visualizing data is often a crucial part of analyzing and presenting research findings. *How to Visualize Data with D3* may be helpful for Researchers who want to create custom visualizations for their publications and presentations. The course's lessons on using HTML, JavaScript, and the D3 data visualization library may enable researchers to present their data in a more accessible and impactful way. This is particularly useful for researchers who are working to publish articles.
Instructional Designer
Instructional Designers create engaging and effective learning experiences. The ability to present information visually is a key skill for instructional designers. *How to Visualize Data with D3* may be valuable for Instructional Designers who want to incorporate interactive data visualizations into their online courses and training materials. The course's lessons on using HTML, JavaScript, and the D3 data visualization library may enable designers to create more engaging and informative learning modules. The skills developed within this course may be very helpful for an Instructional Designer.
Information Architect
Information Architects design and organize the structure of websites and applications to ensure usability and findability. This career involves creating intuitive navigation systems and data displays. *How to Visualize Data with D3* may be valuable for Information Architects looking to enhance their data presentation skills. The course's content on using HTML, JavaScript, and the D3 data visualization library to read data, select elements, and style visualizations may be useful. This additional skillset may allow creation of more effective data driven interfaces.
Digital Marketing Analyst
Digital Marketing Analysts track and analyze the performance of online marketing campaigns to optimize strategies and improve results. This role often involves visualizing data to identify trends and patterns. *How to Visualize Data with D3* may be helpful for Digital Marketing Analysts looking to create custom visualizations beyond standard reporting tools. The course's lessons on using HTML, JavaScript, and the D3 data visualization library may enable analysts to present campaign data in more engaging and insightful ways. You may find the course to be a worthwhile investment in communicating the value of digital marketing efforts.
Technical Writer
Technical Writers create documentation and guides for software and hardware products. The ability to illustrate complex concepts with visuals is a valuable asset for technical writers. *How to Visualize Data with D3* may be helpful for Technical Writers who want to incorporate interactive data visualizations into their documentation. The course's lessons on using HTML, JavaScript, and the D3 data visualization library may enable writers to create more engaging and informative content. This skill could set a Technical Writer apart from other job applicants.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in How to Visualize Data with D3.
Provides a comprehensive introduction to D3.js and data visualization techniques. It covers the fundamentals of D3, including data binding, scales, axes, and transitions. This book valuable resource for understanding the core concepts of D3 and building interactive visualizations. It is commonly used as a textbook for data visualization courses.
Provides a more advanced treatment of D3.js, covering topics such as animations, interactions, and custom components. It good choice for those who want to take their D3 skills to the next level. This book is more valuable as additional reading than it is as a current reference. It is commonly used by industry professionals.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser