score:4
Accepted answer
in previous versions of chart.js (for example 2.6) the onhover handler has to be configured as below:
hover: {
onhover: function(evt, item) {
if (item.length) {
console.log("onhover", item, evt.type);
console.log(">data", item[0]._index, data.datasets[0].data[item[0]._index]);
}
}
},
itme[0]._index
property points to data of target item
so your fiddle (chart.js 2.6) updated is: https://jsfiddle.net/beaver71/440l5661/
with chart.js 2.7: https://jsfiddle.net/beaver71/ttrak7sj/
Source: stackoverflow.com
Related Query
- ChartJS: get points information on hovering the points
- How to change cursor style to pointer on hovering over points of the chart?
- React ChartJS 2 : Get data on clicking the chart
- Points cut at half at the edges of top and bottom, at chartjs
- How to get the database data into ChartJS using codeigniter
- How to reduce the number of points shown on line chartjs chart with a large dataset?
- How to reuse a Chartjs Chart component in with different Data and get past the **Canvas is already in use** error?
- How to get the data attribute of the canvas chart created using chartjs
- ChartJS 3.7.1 tooltip callback, get label value for the next index
- chartjs how to update dynamically data from database(Chartjs cant get the data)
- ChartJS hover/tooltips: selecting the correct points in the datasets based on x-value
- How do I get the current step size of a chartjs chart whose stepSize I have not defined?
- How to fix the distance between horizontal points (x-axis) in chartJS
- How do you get the width of a datalabel from the Chartjs plugin after the chart animates?
- How to get the image from graph created using chartjs
- ChartJs How to display horizontal and vertical lines through the datasets points with their values on axes?
- How to use GET method to choose the right table to show ChartJS graph?
- Hide points in ChartJS LineGraph
- Skip decimal points on y-axis in chartJS
- Chartjs Bar Chart showing old data when hovering
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- Moving vertical line when hovering over the chart using chart.js
- Truncating canvas labels in ChartJS while keeping the full label value in the tooltips
- ChartJs 2.0 How do I obtain point information being clicked upon?
- Adding Image inside Linechart points in ChartJs
- What's the most effective way to implement a radar plot with 50 points at arbitrary locations using chart.js
- How get sum of total values in stackedBar ChartJs
- Dynamically update the options of a chart in chartjs using Javascript
- ChartJS : How to leave just points without lines
- ChartJs line chart repaint glitch while hovering over
More Query from same tag
- chart js bar chart add animation to change color
- ChartJS: Custom tooltip always displaying
- Chart js. How to align text by the center of the tooltip?
- Cannot access a variable declared outside a For loop (Javascript)
- Chart.js Radar background color of background
- Using chart.js, how do I align bars instead of centering them when there are only a few bars to display?
- How to display label inside pie chart in Chartkick?
- Remove all borders from my chart in angular-chart-js
- ChartJS - Why is the transition on the first dataset bad?
- Chart.JS - Tooltips - Issue: 3 data points, all three individual tooltips showing for each data point
- How to align Chart JS "legend" on right-center
- Can you remove the xAxes border line and keep the ticks only?
- Chart JS : Getting issue with draw bar chart
- How to make multiple horizontal bar chartjs
- text inside the bar - chart.js
- Chart.js - cannot read property
- Chart.js turn labels into links
- Chart.js Point image on hover
- Uncaught ReferenceError: Chart is not defined at test.html:11
- ChartJS canvas not displaying colors in edge browser
- Chart.js - Define custom y-axis scale
- Angular Chartjs How to make it reactive to data change?
- Is it possible to add image behind doughnut chart with transparency color in ng2chart?
- Why Chart.js's tooltip appears in wrong position when mouse hover?
- How to use 'time' (data from database, data type: timestamp ) for plotting graph in Chart JS
- Have the time on x axes to show the last 24 hours from current time
- Change time format in Chart.js date
- How to display only one label in a multi line char?
- Show X axis on top and bottom in line chart rendered with Chart.js 2.4.0
- Ionic Capacitor chart.js showing blank on ios device