Show a tooltip for a specific point in a line chart after completing the initial animation

Assume that the following line chart is shown in Chart.js 2:

https://jsfiddle.net/742zut83/

The code is as follows:

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: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.4/Chart.min.js"></script> <canvas id="myChart" width="400" height="400"></canvas> 

Immediately after the initial animation, I need a hint for a specific point, for example. a dot labeled "Green" to appear as if someone was hovering over a dot and staying there until the end of time. The default tooltip behavior when you hover over a point should preferably be turned off for all points, leaving the chart somewhat static after the initial animation and the tooltip appear.

+1
source share

Source: https://habr.com/ru/post/1261618/


All Articles