Coder Social home page Coder Social logo

Comments (4)

timhall avatar timhall commented on July 30, 2024

Thanks @tpitale for bringing this up, it was a fairly large assumption to default to 0 as the minimum for all non-ordinal scales. I'll update it to simply use the minimum shortly (with the existing option to override with domain, if specified).

from d3.compose.

tpitale avatar tpitale commented on July 30, 2024

I'd be happy to submit a PR if you'd like one.

from d3.compose.

tpitale avatar tpitale commented on July 30, 2024

Or I could wait to try until after #43 is completed/merged.

from d3.compose.

timhall avatar timhall commented on July 30, 2024

I'm a little on the fence about the future of createScale currently, it does too much and makes a few too many assumptions for my tastes. I have been thinking of breaking it into a few different approaches:

  • Add scaleBandSeries that extends scaleBand in d3 v4. This covers the adjacent, centered, and series options
  • Add getMinMaxDomain and getOrdinalDomain that handle data and key options for setting domains for linear-link and ordinal scales, respectively.

The getMinMaxDomain should cover this case, although I just looked at it and it has the same issue: vNext:src/mixins/xy (which in some ways is more egregious here since it has min in the name). I'll update it in that PR before it gets merged (which should be today or tomorrow).

I think the new approach is much more direct (with the tradeoff being slightly more to type), although I'm open to adding createScale back as an add-on.

// Before
var xScale = {type: 'time', data: data, key: 'date'};
var x2Scale = {type: 'ordinal', domain: ['a', 'b', 'c'], adjacent: true, series: 2};

// After
var xScale = d3.time.scale()
  .domain(getMinMaxDomain(data, 'date'));
var x2Scale = scaleBandSeries()
  .domain(['a', 'b', 'c']).adjacent(true).seriesCount(2);

I'm glad to hear you're using the library and would love to have your feedback!

from d3.compose.

Related Issues (8)

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.