전체 사용자 중 활성/비활성 비율이나
구매 상품중 카테고리 분포등 다양하게 활용되는 지표 그래프를 그립니다.
대시보드에 주로 사용됩니다.
resource: mysql.qa
name: category
display: metric
sql: >
SELECT count(id) as 'c'
FROM PropertyProfile
GROUP BY ISNULL(`signed_at`)
ORDER BY 1 DESC
metricOptions:
type: category
names:
- Active users
- Inactive users
value: c
total: 전체 사용자
안녕하세요. 위 예제는 조회된 값을 순서대로 names 순서에 맞게 label 처리를 하게 됩니다. (ORDER BY 1 DESC: 값이 큰 순서대로 Active users, Inactive users 에 맞게 표시)
추가로 아래와 같이 특정 컬럼(필드)의 값에 따라 그룹(GROUP BY)하여 순서대로 표기할 수도 있습니다.
- type: query
resource: mysql.qa
name: category
display: metric
sql: >
SELECT `type`, count(id) as 'c'
FROM PropertyProfile
WHERE `type` IS NOT NULL
GROUP BY `type`
ORDER BY 2 DESC
metricOptions:
type: category
name: type
value: c
total: 타입 분포