const _options=
{
indexAxis: 'y',
// Elements options apply to all of the options unless overridden in a dataset
// In this case, we are setting the border of each horizontal bar to be 2px wide
elements: {
bar: {
borderWidth: 2,
}
},
responsive: true,
plugins: {
legend: {
position: 'right',
},
title: {
display: true,
text: 'Chart.js Horizontal Bar Chart'
}
}
};
차트를 생성한다. 차트의 형태에 따라 options값을 달리하면 된다.
chart = new Chart(ctx, {
type: 'bar', // 차트의 형태
data : lineChartData,
options : options
});