0

I use ngx-chart to create a piechart like thins:

Template

  <ngx-charts-pie-chart
                      [scheme]="colorScheme"
                      [labels]="true"
                      [legend]="false"
                      [labelFormatting]="setLabelFormatting"
                      [arcWidth]="0.16"
                      [doughnut]="true"
                      [results]="patients"
                      (select)="onSelect($event)">
  </ngx-charts-pie-chart>

component

Send array with data like this

  public patients: Array<any> = [
    {
      name: 'recorrente',
      value : 67
    }, {
      name: 'novos',
      value: 33
    }
  ];

But i need to send my data with html/css tags to personalize label, i try return function with that but doesn't work.

lesimoes
  • 888
  • 2
  • 9
  • 26

1 Answers1

1

Put the template of labels inside tag :

<ng-template #tooltipTemplate let-model="model">
   <h6 style="color: #fff">{{model.series}} - {{model.name}}</h6>
   <h6 style="color: #fff">It's around {{model.value | number:'1.1-2'}}%</h6>
</ng-template>
Rohan Kumar
  • 40,431
  • 11
  • 76
  • 106
Roksarr
  • 66
  • 1