JavaScript

[JavaScript / Echart] 차트 x,y 축 없애기

냠냠쿠 2023. 11. 28. 14:33
728x90

 

축 없애기 전 / 후

 

  xAxis: [
    {
      type: 'category',
      axisTick: {
        alignWithLabel: true
      },
      axisLine: {
        show: false}, // 여기 수정하면 됨 
      // prettier-ignore
      data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    }
  ],
  yAxis: [
    {
      type: 'value',
      name: 'Evaporation',
      position: 'right',
      alignTicks: true,
      axisLine: {
        show: false, // 여기 수정하면 됨 
        lineStyle: {
          color: colors[0]
        }
      },
      axisLabel: {
        formatter: '{value} ml'
      }
    },

 

x축과 y축을 없애고 싶을 때 (선만 없애고 라벨은 그대로 두고 싶을 때) 위와 같이 axisLine : { show : false } 를 넣어주면 된다.

728x90