Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept iterables. #153

Merged
merged 18 commits into from
Aug 19, 2020
Merged

Accept iterables. #153

merged 18 commits into from
Aug 19, 2020

Conversation

mbostock
Copy link
Member

Fixes #148.

@mbostock mbostock marked this pull request as ready for review November 19, 2019 18:06
@Fil
Copy link
Member

Fil commented Nov 19, 2019

I just tested 5a4e792 on a notebook I was working on today 👍

@mbostock
Copy link
Member Author

mbostock commented Feb 6, 2020

Here’s a good example of how iterables support will help:

https://observablehq.com/@mbostock/revenue-by-music-format-1973-2018

Before:

series = d3.stack()
    .keys(Array.from(colors.keys()))
    .value(([, group], name) => group.get(name).value)
    .order(d3.stackOrderReverse)
  (Array.from(d3.rollup(data, ([d]) => d, d => +d.date, d => d.name)))

After:

series = d3.stack()
    .keys(colors.keys())
    .value(([, group], name) => group.get(name).value)
    .order(d3.stackOrderReverse)
  (d3.rollup(data, ([d]) => d, d => +d.date, d => d.name))

Similarly with d3-scale support, before:

color = d3.scaleOrdinal()
    .domain(Array.from(colors.keys()))
    .range(Array.from(colors.values()))

After:

color = d3.scaleOrdinal()
    .domain(colors.keys())
    .range(colors.values())
@Fil

This comment has been minimized.

@Fil Fil merged commit a1d22ee into master Aug 19, 2020
@Fil Fil deleted the two branch August 19, 2020 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants