Axis extends ChartItem
subclasses CategoryAxis, ContinuousAxis
차트 축 모델들의 기반(base) 클래스.
옵션 모델은 AxisOptions이다.
축은 시리즈 데이터포인트들이 표시될 위치를 지정하는 차트의 핵심 구성 요소이고,
축 설정에 따라 같은 데이터도 다양한 배치로 표현될 수 있다.
기본 적으로 카테고리 축과 연속 축으로 구별되며, 2차원 차트에 맞게 x|y 축을 구별해서 설정한다.
const config = {
xAxis: {},
yAxis: {}
}또, 방향마다 둘 이상의 축을 설정하고 각 시리즈들이 연결할 축을 다르게 설정할 수 있다.
차트에서 축을 명식적으로 지정하지 않으면, 첫번째 시리즈에 합당한 축이 기본 생성된다.
축 개요 페이지를 참조한다.
Properties
crosshair: Crosshair readonly
Crosshair 모델.
직선 또는 bar 형태로 축 위의 마우스 위치를 표시한다.
default :undefined
grid: AxisGrid readonly
축 그리드 설정 모델.
tick의 위치에 수평 혹은 수직선으로 plot 영역을 구분 표시한다.
default :undefined
label: AxisLabel readonly
축 label 설정 모델.
default :undefined
line: AxisLine readonly
축 선 모델.
default :undefined
name: string (opens in a new tab) readonly
축 이름.
default :undefined
options: AxisOptions readonly
차트를 생성할 때나 updateOptions 등을 통해 이 모델 객체에 설정된 옵션 값들과
기본 설정값들이 포함된 원본 설정 객체(복사본이 아니다).
리턴된 객체의 속성값들을 가져올 수 있지만,
속성들을 직접 수정하는 것은 권장되는 방법이 아니다.
updateOptions나 updateOption 등을 사용해서 옵션들을 변경해야 한다.
default :undefined
scrollBar: AxisScrollBar readonly
축 스크롤바 모델.
default :undefined
sectorLine: AxisSectorLine readonly
부채꼴 polar 좌표계의 X 축일 때 원호의 양 끝과 중심에 연결되는 선분들의 설정 모델.
startAngle, totalAngle을 참조한다.
default :undefined
tick: AxisTick readonly
축에 표시되는 tick 위치와 표시 마크에 관한 설정 모델.
default :undefined
title: AxisTitle readonly
축 타이틀 모델.
default :undefined
unitLabel: AxisUnitLabel readonly
단위 label 모델.
default :undefined
visible: boolean (opens in a new tab) readonly
표시 여부.
설정 옵션의 visible 값을 그대로 return하는 것이 아니라,
undefined나 null 등으로 지정하는 경우 모델의 상태에 따라 true나 false로 해석될 수 있다.
설정의 경우 updateOption으로 지정하는 것과 동일하다.
model.updateOption('visible', value);model.updateOptions({
visible: value
});default :undefined
xy: 'x' | 'y' readonly
축 방향.
default :undefined
Methods
clearOptions(render?): Axis
updateOptions나 updateOption 등을 통해 설정된 모든 옵션 값들을 제거하거나,
전역 기본값이 존재하는 경우 그 값으로 되돌린다.
| Parameter | Type | Description |
|---|---|---|
render=true | boolean (opens in a new tab) | true(기본값)으로 지정하면 차트를 다시 그린다. |
return 객체 자신.
destroy(): null
객체가 소유한 참조 등을 해제하고 null을 리턴한다.
model = model.destroy();return null
getStartAngle(): number (opens in a new tab)
radian으로 리턴한다.
getTotalAngle(): number (opens in a new tab)
radian으로 리턴한다.
isEmpty(): boolean (opens in a new tab)
시리즈 연결 여부.
연결된 시리즈가 하나도 없으면 true.
isZoomed(): boolean (opens in a new tab)
zoom 상태인 지 확인한다.
return zoom 상태이면 true.
loadOptions(source): Axis
기존 옵션 값들을 모두 제거하고 source에 지정한 값들로 새로 구성한다.
chart.legend.loadOptions({
visible: true,
location: 'right
})| Parameter | Type | Description |
|---|---|---|
| source | AxisOptions | 설정 정보 객체 혹은 단일값. |
return 이 객체 자신.
removeOption(prop, render?): Axis
지정한 속성에 설정한 값이 있으면 제거하고, 기본값으로(있다면) 되돌린다.
| Parameter | Type | Description |
|---|---|---|
| prop | keyof (opens in a new tab) AxisOptions | 속성 이름. |
render=true | boolean (opens in a new tab) | true(기본값)으로 지정하면 차트를 다시 그린다. |
return 객체 자신.
resetZoom(): void (opens in a new tab)
zoom 상태를 제거한다.
saveOptions(recursive?): any (opens in a new tab)
이 모델 객체에 설정된 전역 기본값과 다른 옵션 값들이 포함된 사본 객체로 리턴한다.
options 객체에는 전역 기본값들도 포함되어 있다.
const options = chart.legend.saveOptions();
console.log(options);| Parameter | Type | Description |
|---|---|---|
recursive=true | boolean (opens in a new tab) | 기본값 true이면 하위 모델의 옵션들도 포함된다. |
return 옵션 사본 객체.
setStyle(prop, value, render?): Axis
모델 css style 값을 변경한다.
value에 undefined나 null, ''을 지정하면 기존에 설정됐던 스타일 항목이 제거된다.
| Parameter | Type | Description |
|---|---|---|
| prop | string (opens in a new tab) | css 스타일 항목 이름. |
| value | any (opens in a new tab) | 적용할 스타일 값. |
render=true | boolean (opens in a new tab) | true로 지정하면 옵션 변경 시 맵차트를 다시 그린다. 기본값 true |
setStyles(props, clear?, render?): Axis
여러 항목의 모델 css style 값들을 json 객체로 지정해서 동시에 변경한다.
value에 undefined나 null, ''을 지정하면 기존에 설정됐던 스타일 항목이 제거된다.
| Parameter | Type | Description |
|---|---|---|
| props | object (opens in a new tab) | 스타일 항목들과 값들이 설정된 json 객체 |
clear=false | boolean (opens in a new tab) | true로 지정하면 기존 스타일 값을 모두 제거한다. 기본값 false |
render=true | boolean (opens in a new tab) | true로 지정하면 옵션 변경 시 맵차트를 다시 그린다. 기본값 true |
toggleOption(prop, render?): Axis
Boolean 타입의 설정값을 변경한다.
지정 가능한 설정 값 목록은 Configuration API 페이지에서 확인할 수 있다.
chart.getSeries('ser02').toggleOption('visible');| Parameter | Type | Description |
|---|---|---|
| prop | keyof (opens in a new tab) AxisOptions | 설정 속성 이름. |
render=true | boolean (opens in a new tab) | true로 지정하면 chart를 다시 그린다. false로 지정하고 여러 설정 후에 render를 호출해서 다시 그리게 할 수도 있다. 기본값은 true. |
return 객체 자신.
updateOption(prop, value, render?, force?): Axis
하나의 속성 값을 설정한다.
여러 속성들을 한꺼번에 변경할 때는 updateOptions를 사용한다.
기본적으로 이전 값과 다른 경우에만 적용된다.
특히, 속성값이 객체인 경우 객체 속성만 바뀐 경우 적용되지 않는다.
바꾸고 싶다면 force 매개변수를 true로 지정해서 호출한다.
또, prop 매개변수가 하위 모델 이름인 경우 하위 모델의 updateOptions를 호출한 것과 동일하다.
| Parameter | Type | Description |
|---|---|---|
| prop | keyof (opens in a new tab) AxisOptions | |
| value | any (opens in a new tab) | |
render=true | boolean (opens in a new tab) | true로 지정하면 설정 후 차트를 다시 그린다. |
force=false | boolean (opens in a new tab) | 지정한 값이 이전 값과 동일한 경우에도 적용한다. |
return 객체 자신.
zoom(start, end, minSize?): boolean (opens in a new tab)
zoom 상태를 새로운 범위로 변경한다.
| Parameter | Type | Description |
|---|---|---|
| start | number (opens in a new tab) | 표시할 시작 값. |
| end | number (opens in a new tab) | 표시할 끝 값. |
minSize=NaN | number (opens in a new tab) | 최소 범위 |
return zoom 상태가 변경되면 true.