Skip to content

Understanding the Interval Property #148

Description

@adrianmcli

I'm having trouble understanding how the CartesianAxis interval property works.

My main goal is to make sure that every number on the scale must be an integer (no decimal places allowed).

Unfortunately, when I set:

<YAxis interval={0} />

I get this:

screen shot 2016-07-19 at 1 57 02 am

But when I set:

<YAxis interval={1} />

I get:

screen shot 2016-07-19 at 1 57 44 am

And when I set:

<YAxis interval={2} />

I get:

screen shot 2016-07-19 at 1 59 56 am

I find this to be very strange, because I was expecting the interval prop to mean the base number for ticks to be generated.

For example:

  • For interval={1}, I would expect: 0, 1, 2, 3, 4, 5, 6, 7, 8
  • For interval={2}, I would expect: 0, 2, 4, 6, 8, 10, 12, 14

Can I get some explanation for how the interval prop actually works. I tried to read through the source code, but it was a little confusing. I'll try again tomorrow, but if you have a better explanation, I could rephrase it for you and submit a PR to the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions