과제 : 중앙에 문자가 있는 도우넛 차트를 만들고자 합니다.
해결하는 방법은 Inline SVG 이미지를 배경 이미지로 사용하는 차트입니다.
SVG는 매우 강력하며 모든 종류의 동적 이미지를 프로그래밍하는 데 사용할 수 있습니다. 이 예에는 두 개의 원과 중앙에 있는 텍스트가 있습니다. 여러 브라우저에서 테스트하세요
일부는 인코딩이 까다로우며 URI는 url에 안전하고 ansi여야 합니다.
SVG Example
='data:image/svg+xml,' &
'<circle cx="20" cy="20" r="15.9" stroke="Gainsboro" fill="transparent" stroke-width="5"/>' &
'<circle cx="20" cy="20" r="15.9" stroke="Green" fill="transparent" stroke-width="3.5" stroke-dashoffset="25" stroke-dasharray="' &
kpi% & ' ' & 100 - kpi%
& '"></circle>' &
'<text text-anchor="start" font-family="Open Sans" font-weight="bold" font-size="10" fill="black">' &
'<tspan dominant-baseline="central" text-anchor="middle" x="20" y="20">' & kpi% & '</tspan>' &
'</text>' &
'</svg>'
SVG 설명
반지름이 r = 15.9인 원주는 2 * pi * 15.9 = 99.9 ∼ 100과 같습니다.
stroke-dasharray="60 40", 여기서 60 - 대시 40 - 간격
양수 값인 stroke-dashoffset = 25는 선을 반시계 방향으로 1/4만큼 이동합니다.
기본 - stroke-dashoffset = 0 원은 90도, 즉 첫 번째 사분면의 x축에서 시작
작성방법
1. 맵 차트 작성
2. 영역 레이어 및 백그라운드 레이어 추가
1. 영역 레이어
위치 -> 위치 필드 수식 : ='[[[0,0],[0,40],[40,40],[40,0]]]'
1. 백그라운드 레이어
서식 : 이미지
URL :
='data:image/svg+xml,' &
'<circle cx="20" cy="20" r="15.9" stroke="Gainsboro" fill="transparent" stroke-width="5"/>' &
'<circle cx="20" cy="20" r="15.9" stroke="Green" fill="transparent" stroke-width="3.5" stroke-dashoffset="25" stroke-dasharray="' &
round(sum(Sales)/sum({1} Sales)*100)
& ' ' &
round(100-sum(Sales)/sum({1} Sales)*100)
& '"></circle>' &
'<text text-anchor="start" font-family="Open Sans" font-weight="bold" font-size="10" fill="black">' &
'<tspan dominant-baseline="central" text-anchor="middle" x="20" y="20">'
& num(sum(Sales)/sum({1} Sales),'0%') & '</tspan>' &
'</text>' &
'</svg>'
이미지 위치 :
위쪽(위도) : 40
왼쪽(경도) : 0
아래쪽(위도) : 0
오른쪽(경도) : 40
For more information
https://qliksense.tistory.com/
https://blog.naver.com/about_qlik
Qliker
'Qlik Sense 개발가이드' 카테고리의 다른 글
누적 바차트에 사용자지정 레이블(2) (0) | 2022.07.27 |
---|---|
클릭센스 적재시간 단축 방법 (0) | 2022.07.24 |
CSS코드로 테이블에 스트라이프 추가 (0) | 2022.07.21 |
차트에 배경색 및 텍스트 삽입 (0) | 2022.07.21 |
Qlik Sense에서 ObjectID 찾는 방법 (0) | 2022.07.21 |