Front/JS & jQuery

[js][Echarts] 차트에 데이터 이름 표시하기

오선지♬ 2024. 12. 28. 13:33
728x90
반응형
label: {
    show: true,
    fontSize: 12,
    fontWeight: "bold",
    position: "inside", // Position the label inside the bar
    color: "black",
    formatter: function(data) {
        const seriesName = data.seriesName; // The series name (e.g., '영업수익')
        const value = Common.numberWithCommas(data.data); // The value, formatted
        return `${seriesName}\n${value}`; // Add a newline character between the series name and value
    }
}

 

데이터이름 :  const seriesName = data.seriesName;

 

\n 포함 => 이름 + 줄바꿈 + 수치

728x90
반응형