Answers for "place icon before labels"

0

place icon before labels

var ctx = document.getElementById("canvas").getContext("2d");

var data = {
  labels: ['January', 'February', 'March'],
  datasets: [{
    data: [1, 2, 3]
  }]
};

var myLineChart = new Chart(ctx, {
  type: 'line',
  data: data,
  options: {
    showAllTooltips: true,
    tooltips: {
      custom: function(tooltip) {
        if (!tooltip) return;
        // disable displaying the color box;
        tooltip.displayColors = false;
      },
      callbacks: {
        // use label callback to return the desired label
        label: function(tooltipItem, data) {
          return tooltipItem.xLabel + " :" + tooltipItem.yLabel;
        },
        // remove title
        title: function(tooltipItem, data) {
          return;
        }
      }
    }
  }
});
Posted by: Guest on July-27-2021

Code answers related to "place icon before labels"

Browse Popular Code Answers by Language