ciprianciurea / chartjs-plugin-doughnutlabel

Chart.js plugin for doughnut chart to display text in the center
https://ciprianciurea.github.io/chartjs-plugin-doughnutlabel/samples/index.html
MIT License
67 stars 23 forks source link

unable to sync label in center of donut with caption filtering #16

Open babaghayou opened 3 years ago

babaghayou commented 3 years ago

I am using ng2-charts with the chartjs-plugin-donut label

my problem is that I cannot update the total in my dougnut label with the filtering offered by charts js

    @Input() set total(total: number) {
        this.totalElements = total;
        this.doughnutChartOptions = {
            devicePixelRatio: 1.5,
            responsive: true,
            layout: {
                padding: {
                    left: 10,
                    right: 10,
                    top: 10,
                    bottom: 10
                }
            },
            legend: {
                position: this.doughnutChartLegendPosition,
                labels: {
                    boxWidth: 20,
                    fontColor: '#141741',
                    fontSize: 10,
                    fontFamily: 'Helvetica, Roboto, Arial, sans-serif'
                }
            },
            animation: {
                animateScale: true,
                animateRotate: true
            },
            plugins: {
                doughnutlabel: {
                    labels: [
                        {
                            text: this.totalElements,
                            font: {
                                size: '60',
                                units: 'em',
                                family: 'Arial, Helvetica, sans-serif',
                                style: 'italic',
                                weight: 'bold'
                            }
                        }
                    ]
                }
            }
        };
    }
KevinJue commented 3 years ago

@ciprianciurea Hello, do you have a solution or a tips to do that ?

I actually need to do the same thing, update the label at the center of donuts after filtering data