0

i have chart.js like this :

const options = {
  type: 'bar',
  data: {
    labels: ["Smartphone", "Trahsphone"],
    datasets: [{
      label: '# of Votes',
      data: [4, 4],
      backgroundColor: [
        'rgba(255, 99, 132, 0.9)',
        'rgba(54, 162, 235, 0.7)',
      ]
    }]
  },
  options: {
    scales: {
      yAxes: [{
        ticks: {
          min: 0,
          max: 10,
          stepSize: 1
        }
      }]
    }
  }
}

const ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
<body>
  <canvas id="chartJSContainer" width="600" height="400"></canvas>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.js"></script>
</body>

i want to find out, how to adding label on my chart, so the data which means 4 on smartphone, and 4 on Trahsphone are appear without we click it first.

so expected result would be like this

enter image description here

tryharder
  • 43
  • 5
  • Does this answer your question? [Show data values in Chart.js bars (version 3)](https://stackoverflow.com/questions/67789090/show-data-values-in-chart-js-bars-version-3) – LeeLenalee Dec 01 '21 at 09:03

0 Answers0