반응형
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- tomcat7
- springboot
- 한성대맛집
- 파이썬
- 성북구맛집
- 공무원
- 성신여대맛집
- 통영
- 통영에어비앤비
- 성신여대편백집
- react
- 서울숲누룽지통닭구이
- ubuntu자바설치
- 통영여행
- 돈암동맛집
- 자바스크립트에러처리
- 스페인여행
- 꼴뚜기회
- JavaScript
- 뚝섬역맛집
- 통영예쁜카페
- 영화추천
- 방이편백육분삼십
- 방이편백육분삼십성신여대
- ELK
- npm
- gradle
- 국가직
- 한남동맛집
- 퇴사후공무원
Archives
- Today
- Total
코린이의 기록
[chart.js] Config example 본문
반응형
Config Options
myChart = new Chart(ctx, {
type: 'doughnut',
data: {
....
},
options: {
// 여기에 들어갈 옵션들
},
}
});
Responsive Charts
| Name | Type | Default | Description |
| responsive | boolean | true | 값이 true이면 chart의 canvas size를 resizing할 수있다. |
| ` | number | 0 | Duration in milliseconds it takes to animate to new size after a resize event. |
| maintainAspectRatio | boolean | true | Maintain the original canvas aspect ratio (width / height) when resizing. |
| aspectRatio | number | 2 | Canvas aspect ratio (i.e. width / height, a value of 1 representing a square canvas). Note that this option is ignored if the height is explicitly defined either as attribute or via the style. |
| onResize | function | null | Called when a resize occurs. Gets passed two arguments: the chart instance and the new size. |
responsive: true

responsive: false

demo ↓
Doughnut & Pie
| Name | Type | Default | Description |
| cutoutPercentage | number | 50 - for doughnut, 0 - for pie | 차트 가운데를 자르는 비율. (0이면 pie에 가깝고 50이면 도넛에 가까움.) |
| rotation | number | -0.5 * Math.PI | chart의 시작점 |
| circumference | number | 2 * Math.PI | Sweep to allow arcs to cover. |
| animation.animateRotate | boolean | true | true이면 chart가 회전하면서 display됨. |
| animation.animateScale | boolean | false | true이면 chart 크기가 커지면서 display됨. |
1. cutoutPercentage
options: {
cutoutPercentage: 60,
}
cutoutPercentage : 0 (파이모양)

cutoutPercentage : 60 (도넛모양)

2. rotation
options: {
rotation: 50,
}
rotation: default (-0.5 * Math.path)

rotation : 50

3. circumference
options: {
circumference: 6,
}
circumference : default (2 * Math.PI)

circumference : 6

4. animation.animateRotate & animation.animateRotate
options: {
animation: {
animateScale: true,
animateRotate: true
}
}
Reference : https://www.chartjs.org/docs/latest/
반응형
'javascript,HTML,CSS' 카테고리의 다른 글
| [javascript] HTMS2Canvas를 이용하여 multiple-page PDF 만드는 방법 (1) | 2020.02.20 |
|---|---|
| 웹 페이지 성능 속도를 높이기 위한 몇가지 (0) | 2020.02.07 |
| [js] ajax 호출 후 순서 섞이는것 해결하기 (동기식 처리) (0) | 2019.09.09 |
| [jquery] "click" event 중복 호출 (0) | 2019.08.02 |
| [ES6] 함수와 추상적 사고 (0) | 2019.07.30 |
Comments