0👍
You can define interaction.mode: 'x'
as explained here.
Please take a look at your amended code below and see how it works.
new Chart('myChart', {
type: "line",
data: {
labels: ["R", "B", "Y", "G", "P", "O"],
datasets: [{
label: "# of Votes",
data: [12, 13, 11, 12, 9, 13]
}]
},
options: {
scales: {
y: {
min: 10
}
},
interaction: {
intersect: false,
mode: 'x'
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.0/chart.min.js"></script>
<canvas id="myChart" height="80"></canvas>
Source:stackexchange.com