Building Responsive Data Visualizations with D3 JS
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
Find online courses made by experts from around the world.
Take your courses with you and learn anywhere, anytime.
Learn and practice real-world skills and achieve your goals.
As part of the user interface, it is important that data visualizations are context aware and should adjust according to screen size, media type, and other similar aspects. To tackle this, it is essential for web developers to ace at both D3 and responsive design using Bootstrap to make visualizations responsive across different viewing platforms. D3 is currently the go-to data visualization library, offering greater integration with web standards, and better customizability than other data visualization libraries available.
This video course starts out by describing ways in which D3JS fits into existing web standards to provide data visualization solutions that can be easily integrated. After working through the basic flow of simple visualizations, we'll start adding features: tooltips, axes, and scales. We'll take a look at interactivity and transitions. Then we'll walk through the use of external data sources, including CSV, TSV, JSON, and GeoJSON, which will prepare us for more in-depth visualizations.
Further on we'll tackle responsive design, covering all the basic concepts, and then work our way through a site mockup the old fashioned way, looking for breakpoints and using media queries to provide smooth screen size transitions. Our work with responsive design will then be applied to a number of our early data visualizations.
By the end of this course, you will have an armoury full of tools to create feature-rich data visualizations with D3JS that are responsive on different platforms.
About the Author
Merrill Cook is currently a freelance data journalist, who has helped to strategize, implement, and market infographics, interactive graphics, interactive maps, scrolling story pages, and a variety of other online media types. He is also the manager of an independent online course and online course platform ranking site.
Not for you? No problem.
30 day money back guarantee.
Learn on the go.
Desktop, iOS and Android.
Certificate of completion.
|Section 1: Building Blocks 1 – Noninteractive, Reusable Charts|
A basic overview of the topics covered in this course.
You want to use the browser's native ability to render SVGs so that you can present some data to your site's visitors. In this case, you want a bar chart, so let's build a nondynamic bar chart with HTML.
It's burdensome and inefficient to maintain a bar chart hardcoded in HTML. So, let's make one that can dynamically adjust to new data in D3.
You have a progression of data points that you want plotted on a line.
You have disorganized multidimensional data points, and you want to see whether there's any trend in the data. In this case, we'll use a simple D3 scatterplot to provide a dynamic way to visualize the data.
|Section 2: Building Blocks 2 – Adding Scales, Axes, and Labels|
There isn't much context for your visualisations varying in pixel values. Users can't even tell which object is which. Let's start by adding the simplest form of labels by appending a text element.
Traditional text labels can be unbecoming, and you aren't always interested in the value of every part of data visualization. Let's solve this problem by creating tooltips that appear on mouseover.
We need a way to uniformly deal with incoming data and output values that will plot well in our given visualization. Let's explore D3 scales so that we can dynamically deal with our growing datasets.
|We need to be able to present labels that operate on the scales being presented in the graphic. So, let's learn ways in which we can visually show the scales we're using.|
|Section 3: Responsive Visual Strategies|
If we're going to be working
Even on fluid grid sites, there are times when the layout or content is out of sync. That's why you need to know how to use media queries to address the breakpoints.
|Sometimes, optimizing the page layout by page size isn't enough to share important, visualizable data. That's why we need to discern the best visualization styles by screen size.|
|Even if the overall site layout is optimized, it doesn't mean visualizations are clear. That's why we need to explore adjusting charts based on the screen size.|
|Even if you know the syntax and handlers to use to resize charts, it can be hard to know what to resize and when. So, let's look at some previous charts and strategize about making them responsive.|
|Section 4: Building Blocks 3 – External Data Sources|
So far, we've used small datasets already stored in an array in our script. This is seldom the way data comes to us in the real world. So, let's use the d3.csv function to start exploring the visualization of external CSV files.
|CSV data is great, but sometimes you'll have to navigate the often highly nested JSON format. Let's see how to load JSON data from an external source, and then wrangle it to create a dynamic bar chart.|
You've learned a few external data sources, but nothing that relates to geographic data. Let's check out the intricacies of GeoJSON.
|Section 5: Building Blocks 4 – Interactivity|
So far, we've only relied on hover and window resize events. This isn't enough for a truly interactive experience, so let's dive into transitions.
|Oftentimes users will want to be provided with a subset of your data that is visually distinguished upon interaction. So, let's work through changing our visualization with D3's filter method.|
|You need the right basic visualization type in order for interactivity to be effective. Let's work through some standard D3 layouts and expand your repertoire.|
|Section 6: Mapping with GeoJSON|
While you can plot whatever you want on a map projection, most people are used to some form of base map giving context to the data. So, let's look at setting up a base map of populated regions in USA.
|The shape of maps often isn't enough to tell the story you would like to tell with data. So, let's jump in and see how to create a chloropleth map using our American-county-based base map from the previous video.|
|While we can see some trends just by looking at the color grouping in our chloropleth, the colors need context. Let's add a legend and tooltips for additional usability.|
|Section 7: Making It Mobile-first|
|We need our map to redraw itself for usability on multiple screen sizes. Before we see what other frameworks can do, let's do it in the old fashioned way—with media queries.|
|Although what you've learned about responsive design and media queries is great, there are a number of powerful frameworks out there that can streamline our workflow. So, let's check out perhaps the best known responsive framework, that is, Bootstrap.|
Particularly in CMS systems, or on sites where content can vary widely by size or format, you may want a one-size-fits-all way to embed your own content in pages. That's why you need PymJS, a tool developed by the NPR visualizations team for embedding.
|Section 8: Moving Forward|
|We've covered a lot, and you should probably try and cement it in your head for future use. There may be points at which you need some additional information to fully get the exercises we worked through, so we've included resources for future study.|
|A lot can be learned by keeping track of the field of data visualization as a whole, as well as knowledge of web standards in general. Let's look at a few people you should follow and things you should be reading.|
Over the past ten years Packt Publishing has developed an extensive catalogue of over 2000 books, e-books and video courses aimed at keeping IT professionals ahead of the technology curve. From new takes on established technologies through to the latest guides on emerging platforms, topics and trends – Packt's focus has always been on giving our customers the working knowledge they need to get the job done. Our Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.