# 파이/도넛 차트에 퍼센트 비율 표시하기

**URL:** <https://ask.selectfromuser.com/t/topic/44>\
**Category:** 사용 팁\
**Tags:** chart\
**Created:** [6월 28, 2023, 10:16오전 UTC](https://ask.selectfromuser.com/t/topic/44 "2023-06-28T10:16:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhlee](https://yyz2.discourse-cdn.com/flex032/user_avatar/ask.selectfromuser.com/jhlee/32/20_2.png) [@jhlee](https://ask.selectfromuser.com/u/jhlee)\
**Post date:** [6월 28, 2023, 10:16오전 UTC](https://ask.selectfromuser.com/t/topic/44/1 "2023-06-28T10:16:45Z")

</div>

카테고리 타입 통계를 시각화 할때 비율이 표시되어있으면 편리합니다.  
셀렉트에서 제공하는 차트에서는 왼쪽 범례(legend)를 클릭시 해당 지표를 제외하여 % 퍼센트를 다시 계산해줍니다.

```auto

resource: mysql.qa
sql: > 
  SELECT COALESCE(`type`, 'NONE') AS tt, count(id) as 'c'
  FROM properties2
  GROUP BY `type`
  ORDER BY 2 DESC
chartOptions:
  type: doughnut
  x: tt
  y: c
  colorschemes: tableau.Tableau20
  height: 400
  width: 700
  options:
    responsive: false
    plugins: 
      legend:
        position: left 
        align: start
      datalabels:
        formatter: percentage
        color: '#fff'

```

 ![Screenshot 2023-06-22 at 2.51.57 PM](https://canada1.discourse-cdn.com/flex032/uploads/selectfromuser/original/1X/602e192e2593b92ae436964bee81b12c1d676fca.png)

\*태블루 색상을 이용 가능합니다.
