Skip to main content
Public

Share visualization

Loading preview…

Reusable Scatter Plot

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Reusable Scatter Plot

0
UUmarani Vemula
Last edited Jul 21, 2023
Created on Jul 21, 2023

This animated scatter plot cycles through the numeric attributes of the Iris dataset, sequentially updating the x-axis to display sepal length, sepal width, petal length, and petal width while keeping petal width on the y-axis. The visualization uses D3's `scaleLinear`, `axisBottom`, and `axisLeft` to render axes, with `transition` controlling the smooth repositioning of circles and axis titles every three seconds. The reusable chart component, built with a custom `scatterPlot` factory, supports setters for data, dimensions, and accessors. Data loads via D3's `csv` from a GitHub Gist, with SVG circles animated through enter, update, and exit joins.

AI-generated description

Added axis titles and animation to the x-axis label.

A couple of questions when making this update:

  1. When using the ternary operator continue does not seem to work whithin a for loop. line 43 of index.js

  2. Need to call the plot() function before i is incremented. Is this related to the fact that this is an async function? So will i only be evaluated within call() and not when the scatterPlot() instance is created? line 65 of index.js

Comments

Sign in to join the discussion.

MIT Licensed