How to enable toolbar in chart for angular

17 Views Asked by At

How to enable toolbar in chart to print and download from below code, i am using ng2-charts and following from https://valor-software.com/ng2-charts/#BarChart

ngOnChanges() { // Pie this.pieChartOptions = { responsive: true, plugins: { legend: { display: true, position: 'bottom', }, title: { text: this.chartInput?.title, display: true, }, subtitle: { text: this.chartInput?.subtitle, display: true, }, datalabels: { formatter: (value: any, ctx: any) => { console.log(value, ctx); if (ctx.chart.data.labels) { return ctx.chart.data.labels[ctx.dataIndex]; } }, }, }, }; this.pieChartData = { labels: this.chartInput?.labels || [], datasets: [ { data: this.chartInput?.data || [], }, ], }; }

code with some example

0

There are 0 best solutions below