본문 바로가기

퍼블리싱/highchart

tooltip의 poinformat을 수정해야 할 때

poinformatter를 사용하면 표출되는 형식을 바꿀수 있는데, 이럴때 기존 formatter 앞에 나오는 동그란 모양의 심볼(?) - 즉 해당 데이터가 어떤 시리즈인지 표시하는 색깔있는 원을 꼭 넣어주고 싶은 경우, 아래 소스 참고.

 

tooltip: {
    pointFormatter: function() {
      return '<span style="color:' + this.color + '">●</span> ' + this.series.name + ': <b>' + this.y  + '</b><br/>';
    },
    shared: true,
    useHTML: true,
  },

+ 필요한경우, point formater 아래에 footer format을 이용해 poinformatter를 수정하지 않고 토탈 값 등 추가 가능

footerFormat: '<b>Total:  {point.total} </b>',
728x90