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

Exposing line interpolator functions #2385

Closed
rcchen opened this issue Apr 8, 2015 · 3 comments
Closed

Exposing line interpolator functions #2385

rcchen opened this issue Apr 8, 2015 · 3 comments
Milestone

Comments

@rcchen
Copy link

rcchen commented Apr 8, 2015

I'm currently working on a charting library that would benefit from having direct access to the interpolation functions available for d3.svg.line/area. Would it be reasonable to create a pull request that does the following:

  1. Break out the interpolators from svg/line.js and puts them into svg/interpolators.js
  2. Refactor the default available interpolator functions from d3_svg_lineLinear to d3.svg.interpolators.linear and so on.

Thoughts?

@mbostock
Copy link
Member

I’m probably on board with this, though I want to think through the API a little bit before we make it public.

Could you elaborate a little bit on how you plan on using these methods? I’m also curious whether it’s necessary to expose these methods directly, or to just use a d3.svg.line instance to do the interpolation for you?

@rcchen
Copy link
Author

rcchen commented Apr 22, 2015

We expose an .interpolate method, like d3 does, but it only takes in functions as a parameter, as opposed to either a function or a string. The reasons we chose to do this are because we wanted:

  • consistency between the getter/setter methods (you always get/set a function)
  • to not be tied to strings specified in d3 that correspond to interpolation functions.

Using a d3.svg.line instance for retrieving interpolation functions seems a little problematic because one would end up creating an instance for no reason other than retrieving instance functions that should have been static in the first place. In addition, given that the interpolation functions are also being used on d3.svg.area, separating interpolators into a higher level (d3.svg.interpolator) might be a cleaner approach.

@mbostock mbostock added this to the 4.0 milestone Oct 21, 2015
@mbostock mbostock added the req label Oct 21, 2015
@mbostock
Copy link
Member

Moved to d3/d3-shape#13 for 4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants