GithubHelp home page GithubHelp logo

Comments (3)

robinhouston avatar robinhouston commented on April 26, 2024

Sorry, my mistake. This is documented behaviour:

These arguments are also passed to the scale’s tickFormat method to generate a tick format (unless a tick format is specified explicitly via axis.tickFormat)

Is there any way to specify the number of ticks while retaining the default tick format?

from d3-axis.

robinhouston avatar robinhouston commented on April 26, 2024

So, one can do it like this:

axis.ticks(5).tickFormat(scale.tickFormat());

That feels a little bit convoluted, though.

from d3-axis.

mbostock avatar mbostock commented on April 26, 2024

Yeah, I think this is a bug. The problem is that the time scale’s tickFormat method isn’t consistent with the other scales, which all take a suggested count as the first argument.

In D3 3.x this wasn’t an issue because the time scale ignored all arguments to scale.tickFormat. So, if you specified a count to axis.ticks, it would affect scale.ticks, but not scale.tickFormat (because a time scale always renders times the same way, dependent only on the input time and not the number of ticks).

We should retain that behavior for D3 4.0.

from d3-axis.

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.