Giter Site home page Giter Site logo

Comments (9)

junedchhipa avatar junedchhipa commented on April 30, 2024 3

@MichaelDanielTom
Removed the condition where smaller values were generating no ticks / single tick on y-axis.
Now, You can control the number of ticks that can be generated by this option

options.yaxis.tickAmount = 6

However, the way you have handled the float values by .toFixed(2) is required for now. I will check whether the series contains float numbers and based on that - decide whether to round off or not.

Thanks

from apexcharts.js.

junedchhipa avatar junedchhipa commented on April 30, 2024 3

Updated the "fraction/decimal" part to allow the user to give a default value.
Currently, the default is set to 2 - b37f249
The option can be set at options.yaxis.decimalsInFloat
Need to add in the docs

from apexcharts.js.

ffxsam avatar ffxsam commented on April 30, 2024 2

Seems like yaxis.decimalsInFloat doesn't work. I set it to 0, yet I still see decimals in my Y axis:

CleanShot 2021-10-26 at 18 32 57

Instead, I have to set this in my yaxis options:

labels: {
  formatter: (value: number) => Math.floor(value),
},

from apexcharts.js.

junedchhipa avatar junedchhipa commented on April 30, 2024 1

Fixed the decimal places also.
Now you don't need to provide options.yaxis.labels.formatter = val => val.toFixed(2) for handling small values

from apexcharts.js.

MichaelDanielTom avatar MichaelDanielTom commented on April 30, 2024

Thanks so much Juned!

from apexcharts.js.

MichaelDanielTom avatar MichaelDanielTom commented on April 30, 2024

@junedchhipa Quick possible improvement could also be to default the representation for floats to truncate after a reasonable amount. Thoughts?

image

from apexcharts.js.

junedchhipa avatar junedchhipa commented on April 30, 2024

Not a bad idea to avoid long fraction parts.
And what should be the name of this option? options.yaxis.decimalsInFloat sounds good? :)

from apexcharts.js.

paaaz avatar paaaz commented on April 30, 2024

Seems like yaxis.decimalsInFloat doesn't work. I set it to 0, yet I still see decimals in my Y axis:

CleanShot 2021-10-26 at 18 32 57

Instead, I have to set this in my yaxis options:

labels: {
  formatter: (value: number) => Math.floor(value),
},

I can confirm that, it already worked with previous versions, now with v3.27.3 it does not seem to work

from apexcharts.js.

malcolm7778 avatar malcolm7778 commented on April 30, 2024

try using react-chartjs-2

from apexcharts.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.