Skip to content

How to show text inside line point onhover #10742

Answered by kurkle
DiegoMcDipster asked this question in Q&A
Discussion options

You must be logged in to vote

You could use the datalabels plugin, or you can do the drawing by your own plugin in afterDraw or afterDatasetDraw hook. More information about plugins: https://www.chartjs.org/docs/latest/developers/plugins.html

For example:

var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
    type: 'line',
    data: {
        labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
        datasets: [{
            label: '# of Votes',
            data: [12, 19, 3, 5, 2, 3]
        }]
    },
    options: {
      hoverRadius: 30,
      plugins: {
        tooltip: false
      }
    },
  plugins: [{
    id: 'hoverValue',
    afterDraw(chart) {
      chart.getActiveElements().

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DiegoMcDipster
Comment options

Answer selected by DiegoMcDipster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants