My Edojobs Super Techies Flight.

I fell in love with tech when i was 12 years old after watching the Computer animated superhero film "Astro Boy" wanting to be like Dr. Tenma who was playing a big role in developing Metro city…


独家优惠奖金 100% 高达 1 BTC + 180 免费旋转

Making a simple scatter plot with d3.js

This tutorial uses d3 v4.6. The CDN is hosted on Cloudflare, so you can start by adding this script tag to your html file:

While still in your html file, add a div with an ID (I’m using #scatter in this tutorial) where you’d like the scatter plot to go:

Now onto the javascript. Create a new javascript file for your graph (don’t forget to go back to your html file and add a script tag for it!).

First, we’ll set our variables for margin, width, and height.

Now we need to append the SVG object to the #scatter div we made earlier in the html.

Optional: If you want to connect your data points like this, add this code for a trend line:

*make sure you sorted your data in the format/sort step, or you may have a weird shape here.

It’s time to add the actual data points:

For both the line and data point code, you can edit the way it looks with the .attr lines.

Add a comment

Related posts:

When to Use MongoDB Rather than MySQL

MySQL and MongoDB represent two sides of an argument that has been raging recently concerning data storage — the tried and tested relational database vs. non-relational or No-SQL database. They are…

10 Most Popular Figma Plugins

On August 1st the cloud based design tool Figma released plugins into their platform. As someone who uses Figma everyday, this was like Christmas morning for me. I got to open a bunch of presents and…


Love is the key to swinging success. It’s about being so in love that you can disclose all of your fantasies and desires to your partner. Some couples have the most beautiful swinging experiences…