Can I apply DataLabel plug-in each graph in 'react-chartjs-2'?

41 Views Asked by At

enter image description here

I would like to apply labels differently for bar charts, pie charts, and line charts. (I hope to show Bar graph show dataLabel only)

Is it possible using the plugin "https://chartjs-plugin-datalabels.netlify.app/guide/getting-started.html"?

Currently, the plugin applies the same labels to all chart types.

Chart.defaults.set("plugins.datalabels")

Thanks for your suffer!

        <Bar
          ref={chartRef}
          data={data}
          options={options}
        />
        <Doughnut
          data={data}
        />
        <Line data={data} options={options} />

to

        <Bar
          ref={chartRef}
          data={data}
          options={options}
          plugins={ChartDataLabels}  // is is possible?
        />
        <Doughnut
          data={data}
        />
        <Line data={data} options={options} />
0

There are 0 best solutions below