Giter VIP home page Giter VIP logo

Comments (4)

netil avatar netil commented on May 28, 2024

@michkami
When there're 2 or more values aligned to single axis(y or y2), the domain range will set according it.

Let's say, given values are 300 and 500, in this case, min=300 and max=500.
But when single value (ex. 500) is given, can't determine min/max, because there's no data to determine or compare.

So, in this case min will be set as 0 and max 500.
https://github.com/naver/billboard.js/blob/master/src/ChartInternal/internals/domain.ts#L136

from billboard.js.

michkami avatar michkami commented on May 28, 2024

@michkami When there're 2 or more values aligned to single axis(y or y2), the domain range will set according it.

Let's say, given values are 300 and 500, in this case, min=300 and max=500. But when single value (ex. 500) is given, can't determine min/max, because there's no data to determine or compare.

So, in this case min will be set as 0 and max 500. https://github.com/naver/billboard.js/blob/master/src/ChartInternal/internals/domain.ts#L136

I see, this makes sense.

Maybe not completely connected to the question above, but I found this line here

// Cancel zerobased if axis_*_min / axis_*_max specified
which cancels the zerobased setting when y min or max is set. But in case of y.min: 0 or y.max: 0 I would still expect the zerobased option put the zero on the x axis level.

Do you see any reason to not add an exception for the 0 values here?

In this case I would expect the zerobased option to still be working:
https://jsfiddle.net/michkami/6vr1z20f/

from billboard.js.

netil avatar netil commented on May 28, 2024

Do you see any reason to not add an exception for the 0 values here?

The conditional stayed from the start of the project and maintained as, mainly to not break any possible issue.
https://github.com/naver/billboard.js/blob/1.0.0/src/internals/domain.js#L156

from billboard.js.

michkami avatar michkami commented on May 28, 2024

The conditional stayed from the start of the project and maintained as, mainly to not break any possible issue. https://github.com/naver/billboard.js/blob/1.0.0/src/internals/domain.js#L156

Yes, I saw this. My question was if there it would be possible to add 0 as an exception here in case zerobased is true, so that the y axis will start on the x axis level when min is set to 0.

The current behaviour is what i would only expect if I set zerobased: false and then set the min value to 0.
If zerobased: true and I set the y axis min to 0, I would expect for it to start at the same level as the x axis.
I played around and saw, that if i pass null to y axis min, it would in this case work as expected, but the types only accept number | undefined.

from billboard.js.

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.