Coder Social home page Coder Social logo

Comments (3)

mbostock avatar mbostock commented on May 2, 2024 1

The problem with named parameters is that it’s kind of a pain to implement the raw projections that way. Also, since we already released the raw projections in d3-geo 1.1 and d3 4.1, it’d have to wait until D3 5.0 anyway. So, I think I’m going to close this. Unlike d3-ease and d3-interpolate I don’t intend the raw projections to be used unless you are defining a custom projection, which should be quite rare (as compared to configuring an existing projection).

from d3-geo-projection.

mbostock avatar mbostock commented on May 2, 2024

There’s a big reason not to define the raw projections as a property of the (non-raw) projection which is that it makes it impossible to import just the raw projection definition: you end up pulling the whole projection pipeline in, including clipping and resampling, which is comparatively huge. Of course in the vast majority of cases this wouldn’t actually matter since you are probably going to need that any if you are working with projections… but still, it’s cleaner if it’s a separate symbol.

As for discoverability, the main thought that comes to mind is using named parameters as we do for d3-ease and d3-interpolate. For example, instead of this:

var bonne = d3.geoBonneRaw(Math.PI / 3);

You’d say this:

var bonne = d3.geoBonneRaw.parallel(Math.PI / 3);

It makes the parameters more discoverable, forces all parameters to have defaults, and eliminates the distinction between parameterizable projections and non-parameterizable projections. Of course it’s still a bit awkward to have the inconsistency between radians and degrees… and the necessary duplicate API in the non-raw projections where some parameters have side-effects like setting a rotation.

from d3-geo-projection.

Fil avatar Fil commented on May 2, 2024

+1 for named parameters; also there seems to be some need for a generic function that would help change a parameter (like parallel1).

from d3-geo-projection.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.