Framework/React

[React] apexcharts yaxis (yμΆ•) labels float μ†Œμˆ˜μ  μ²˜λ¦¬ν•˜λŠ” 방법, toFixed() λ©”μ„œλ“œ μ‚¬μš©

yuri lee 2023. 2. 16. 23:52
λ°˜μ‘ν˜•

Intro

μ•ˆλ…•ν•˜μ„Έμš”. 이번 μ‹œκ°„μ—λŠ” apexcharts μ—μ„œ yaxis label 의 μ†Œμˆ˜μ  μ²˜λ¦¬λ°©λ²•μ— λŒ€ν•΄ μ•Œμ•„λ³΄κ² μŠ΅λ‹ˆλ‹€. 

 

How to solve the problem

μ•„λž˜μ™€ 같이 yaxis > labels > formatter λ₯Ό μ μš©ν•˜κ³ , toFixed() λ©”μ†Œλ“œλ₯Ό μ΄μš©ν•˜μ—¬ 값을 μ²˜λ¦¬ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

yaxis: {
    labels: {
      formatter(value) {
        return value.toFixed(0);
      },
    },
  },
λ°˜μ‘ν˜•