Topic: How to set up custom tooltip templates for Charts using Angular2 TypeScript

Łukasz Salamon pro asked 6 years ago


Hi,

I want to set custom formating for values shown in tooltip for base line chart.

I've tried to change options object that is passed to BaseChartDirective but that doesn't seem to have any effect. That's what I've tried:

chartOptions: any = {
  responsive: true,
  tooltipTemplate: "<%if (label){%><%=label %>: <%}%><%= value + ' %' %>",
  multiTooltipTemplate: "<%= value + ' %' %>",
};

Any help would be appreciated.


Edyta Dabrowska free answered 6 years ago


Hi, we are using chart.js library and there you can find everything needed about tooltips. And add what is necessary exactly like you did, in 'chartOptions'.

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags