Skip to content

features legend

강지웅/FE개발팀/NE edited this page Feb 19, 2016 · 8 revisions

Legend Feature

  • Legend 영역과 관련된 Feature들을 소개합니다.

Legend 위치 변경하기

legend.align옵션을 사용하면 Legend 위치를 변경할 수 있습니다.
설정가능한 위치값은 'top', 'bottom', 'left', 'right' 등이 있습니다.
Pie 차트에서는 'center', 'outer'값을 설정하여 범례를 series에 포함시켜 표현할 수 있습니다.

예제
//...
var options = {
    legend: {
        align: 'top'
    }
};
tui.chart.barChart(container, data, options);

Legend 숨기기

legend.hidden옵션을 사용하면 Legend를 숨길 수 있습니다.

예제
//...
var options = {
    legend: {
        hidden: true
    }
};
tui.chart.barChart(container, data, options);

Legend 체크박스 숨기기

legend.hasCheckbox옵션을 사용하면 Legend를 숨길 수 있습니다.
기본값은 true로 설정되며, false를 설정할 경우 숨겨지게 됩니다.

예제
//...
var options = {
    legend: {
        hasCheckbox: false
    }
};
tui.chart.barChart(container, data, options);

Legend 선택 시 선택 Legend정보 얻어오기

selectLegend 이벤트 핸들러를 등록하면 선택된 Legend에 대한 정보를 얻을 수 있습니다.

예제
//...
var chart = tui.chart.barChart(data);

chart.on('selectLegend', function(info) {
  console.log(info);
});
Clone this wiki locally