Framework/React

[React] apexcharts yaxis (y์ถ•) 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜๋Š” ๋ฐฉ๋ฒ•

yuri lee 2023. 2. 17. 21:23
๋ฐ˜์‘ํ˜•

Intro

์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” apexcharts ์—์„œ yaxis y์ถ•์„ 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

apexcharts๋ฅผ ์ด์šฉํ•ด์„œ ์ฐจํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ž‘์—…ํ•˜๊ณ  ์žˆ์—ˆ๋Š”๋ฐ์š”, ์ฐจํŠธ์˜ y์ถ•๊ฐ’์„ 0์œผ๋กœ ๊ณ ์ •ํ•˜๊ณ  ์‹ถ์€๋ฐ, ๊ณ„์† ์ˆซ์ž ๋ฒ”์œ„๊ฐ€ ๋‹ฌ๋ผ์ง€๋ฉด์„œ ๊ฐ’์ด ๋ณ€ํ•˜๋”๋ผ๊ณ ์š”. ๊ทธ๋ž˜์„œ ๊ตฌ๊ธ€๋ง์„ ํ•ด๋ดค์Šต๋‹ˆ๋‹ค.

 

How to solve the problem

์•„๋ž˜์™€ ๊ฐ™์ด yaxis ์†์„ฑ์—์„œ min์„ 0์„ ์ ์šฉํ•˜๋ฉด y์ถ• ๊ฐ’์ด 0์œผ๋กœ ๊ณ ์ •๋˜์–ด ์„ธํŒ…๋ฉ๋‹ˆ๋‹ค.

yaxis: {
  tickAmount: 3.5,
  min: 0,
  forceNiceScale: true,
  labels: {
      show: true,
      rotate: 0,
      style: {
          colors: '#828282',
          fontSize: '11rem',
          fontFamily: 'SpoqaHanSans, Helvetica, Arial, sans-serif',
      },
  },
  axisBorder: {
      show: true,
      offsetX: -4,
      offsetY: 0,
  },
  axisTicks: {
      show: false,
  },
},

 

๋ฐ˜์‘ํ˜•