Giter Site home page Giter Site logo

Comments (7)

jasondavies avatar jasondavies commented on August 17, 2024

It is tantalisingly similar to pv.normalize, though I suppose we would also need an optional padding specifier.

Currently, I think padAngle is a bit specific to donuts/pies because internally it isn’t allowed to be larger than (endAngle - startAngle) / n, and I don’t think that is necessarily desirable in the general case.

from d3-shape.

mbostock avatar mbostock commented on August 17, 2024

I don’t think that restriction on padding makes it specific to pies. If you were to apportion the range [0, 1] up into n pieces by value, wouldn’t you still restrict the maximum padding per piece to 1 / n? Otherwise you’d exceed the given range.

But, that still leaves two characteristics that are pie-specific:

  • The generated objects have startAngle, endAngle and padAngle properties.
  • The range defaults to [0, τ].

I’d be willing to forgive the second, but the first is strongly useful and specific. I suppose you could drop the “angle” suffix and use the generic names “start”, “end” and “pad”, and make the corresponding change to the arc generator. But that seems… undesirable. So I’m going to close this issue.

from d3-shape.

jasondavies avatar jasondavies commented on August 17, 2024

If you were to apportion the range [0, 1] up into n pieces by value, wouldn’t you still restrict the maximum padding per piece to 1 / n? Otherwise you’d exceed the given range.

For a non-circular range, you would restrict the padding to 1 / (n - 1), so it’s a bit different.

from d3-shape.

mbostock avatar mbostock commented on August 17, 2024

That assumes you don’t want padding at the start and end of the range. You might still want that? For that matter, the pie generator can be used with a range that does not form a complete circle, such as [0, π]. It still pads the start of the first arc and the end of the last arc in this case, in part because there’s no way to tell the arc generator that the padding is asymmetric.

For example:

screen shot 2015-12-01 at 10 48 36 am

from d3-shape.

jasondavies avatar jasondavies commented on August 17, 2024

Ah, good point. I agree this is probably not important enough to pursue though; the only other place it might be used would be for ordinal.rangeBands, where the outer padding can be different from the internal padding.

from d3-shape.

mbostock avatar mbostock commented on August 17, 2024

Related d3/d3#2237, which proposes asymmetric padding for arcs.

from d3-shape.

mbostock avatar mbostock commented on August 17, 2024

I took a quick pass at asymmetric padding in #42. For example:

screen shot 2015-12-01 at 11 06 24 am

from d3-shape.

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.