Create a map using D3.js
Author Archives: Qichun Dai
Day 19: Brush Handles
While playing with the brush event yesterday, I noticed that when I click and clear the brush, the line chart of the focus area stays the same. I would expect it to reset to the full dataset. So I added the reset component in the brushed function. Reset after clearing the selection Adding Handle ThisContinue reading “Day 19: Brush Handles”
Day 18: D3 Brush
Today I worked on adding brush to the line chart (the one we created on Day 11). The brush functionality can allow users to zoom in on the data in the main chart while keeping the context of the timeline. Layout What we need to do first is to set up the focus and contextContinue reading “Day 18: D3 Brush”
Day 17: Voronoi Diagram
Today I learned a new trick from fullstack D3 course. It’s called Voronoi diagram, and it will help the hovering event to show the tooltip for the scatter plot. Users do not need to hover exactly on the dot. To show what I mean, see the gif below. As long as the mouse is overContinue reading “Day 17: Voronoi Diagram”
Day 16: Bar Chart Race
Yesterday, we have already prepared the data for this bar chart race. Then we are ready to create this chart. I found two examples to follow: The idea is that we populate a new bar chart at a certain interval. In this example, we will update the bar chart every month. The structure is thatContinue reading “Day 16: Bar Chart Race”
Day 15: Prepare Data for Bar Chart Race
When I was finding the horizontal bar chart examples on Observable yesterday, I came across the bar chart race. I think I can also use my train travel history to create this type of chart. However, I found that my data are not in the format that I can use to inject into the ObservableContinue reading “Day 15: Prepare Data for Bar Chart Race”
Day 14: Why do I move to Utrecht?
Today, I signed the contract for an apartment in Utrecht. Yay! Often people ask me: “Why do you move to Utrecht?” There are so many factors. I like the vibe of the city; I have many friends there; It’s close to Amsterdam; It’s the center of the Netherlands and it has the biggest train stationContinue reading “Day 14: Why do I move to Utrecht?”
Day 13: Adding Animation to Line Charts
Adding animation to the line chart is also different from the scatter plot. Below is how we created the animation for the scatter plot. We set the initial position and the end position of the dot and put the transition between the “cx” and “cy” attributes. The animation I wanted to create is to growContinue reading “Day 13: Adding Animation to Line Charts”
Day 12: Tooltip in Line Charts
I thought adding a tooltip to a line chart will be easy since I already learned to add a tooltip to a scatter plot. However, this process is more complicated than I thought. The reason is that each dot in the scatter plot consists of only one circle, but the line chart draws the lineContinue reading “Day 12: Tooltip in Line Charts”
Day 11: Line Chart
A line chart is usually used for showing the trends over time. To create a line chart, there are two things that changed compared with the scatter plot we created before. Work with Date The x-axis is usually the date. To create the date axis, we will need to use the “d3.timeParse()” and “d3.scaleTime()” toContinue reading “Day 11: Line Chart”