score:0

Accepted answer

to implement custom label there is a chartjs plugin called datalabels which can be imported using cdn

<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@0.7.0"></script>

or using npm

npm i chartjs-plugin-datalabels

refer the below code to which implement custom date as label


 let x = [],
              y = [];
            data.foreach(z => {
              let date = new date(z.datet)
              x.push(date.tolocaledatestring());
            });

            var mylinechart = new chart(ctx, {
              plugins: [chartdatalabels],  
              type: "bar",
              data: {
                labels: x,
                datasets: [
                  {
                    data: y,
                    backgroundcolor: [
                      "rgba(255, 99, 132, 0.2)",
                      "rgba(54, 162, 235, 0.2)",
                      "rgba(255, 206, 86, 0.2)",
                      "rgba(75, 192, 192, 0.2)",
                      "rgba(153, 102, 255, 0.2)",
                      "rgba(255, 159, 64, 0.2)",
                      "rgba(211, 84, 0,0.8)"
                    ]
                  }
                ]
              },
              options: options
            });
          }
        };
    ````



Related Query

More Query from same tag