score:8
Accepted answer
TRY adding the following on-click event handler in your chart options ...
options: {
onClick: function(e) {
var element = this.getElementAtEvent(e);
if (element.length) {
console.log(element[0])
}
},
...
}
This should work as far as I can tell
Source: stackoverflow.com
Related Query
- Angular chart.js onClick is not working - how to get all elements of a bar when it is clicked on
- Css style not working well when resizing chart height in angular application
- How Can I Get An Instance of a ChartJS Bar Chart Using Angular
- Can't get bar chart colors in Chart js working in React Js
- Chartjs - show elements in all datasets on hover using bar chart
- How to set single color on each bar in angular chart js
- How to make bar chart animation where all bars grow at the same speed?
- How do I keep chart.js charts in one JS file, and not get errors when the ID from the JS file don't exist on one specific html page?
- Chart.js: How to get x-axis labels to show on top of bars in bar chart
- Chartjs with Vue, Bar Chart Border Radius not working
- Bar Chart Not Stacking When Using ChartJs
- Charts.js - Colors for stacked bar on multi-series line/bar chart are not working
- Charts.js - Bar chart different colors for value intervals not working
- How do I get a different label for each bar in a bar chart in ChartJS?
- Chart.js in Angular 10: Specified colors not shown in multi-series bar chart (instead random colors)
- Vertical align bar chart from chart.js not working
- vue-chartjs not working properly in flexbox and when resize chart goes blank
- Angular-Charts bar chart does not update when I change the data, series, labels
- $scope variable do not respond to the onClick function of angular chart
- How to get clicked bar chart tooltip data?
- Destroying chart.js is not working when chart created inside function - chart.destroy() is not a function
- Bar Chart not displaying when using chart.js
- How can I get my Chart.JS bar chart to stack two data values together on each bar, and print a calculated value on each bar?
- How to get item what been clicked on Chart (primeNg chart + angular application)
- angular 4 line chart data is not showing data from http get
- ChartJS Bar Chart not respecting disabled legend when using cdn
- ChartJs does not render chart when binding canvas id in Angular
- How to show symbols after the label and before the numeric value using chart.js Bar chart in Angular
- How can I remove the white border from Chart.js pie chart when all legends are hidden?
- How do I get the current step size of a chartjs chart whose stepSize I have not defined?
More Query from same tag
- How to display certain part of chart.js as dotted while rest as bold?
- Where can I download a certain version of d3.js for angular?
- How to make the whole <canvas> element in Chart.js V3.7.0 display cursor as pointer on hover?
- Chart.js PolarArea not able to chance arc width and color
- Aligning zero on y axis to the labels on x axis of line chart in chartjs
- Export HTML content with Chart.jscanvases to PDF
- How can I display desired/particular chart in App.vue from Charts.vue which contains different charts in Vuejs
- Chartjs - Insert additional data into chart tooltip
- ChartJS not working in Vue
- ng2 chart multiple chart update
- Django - rendering two dimensional dictionary data to template
- Chart.js Tooltip Information
- chart.js - problems with axes options - what am I doing wrong?
- How to get line x value from Label chart js
- chart.js plugins.register function with outer data
- jquery load with chart.js
- How to read and plot json with Chart.js
- Displaying the first value of the array in datasets.label Chartjs
- passing json data to chartjs
- Using chart.js in HotTowel , Angular.js
- Create a weekly line chart (52 labels)
- Using Chart.js onClick function, can you execute code from an undefined or null result?
- I want to change color of individual bar of bar graph
- How to show all dates on xAxis between two dates in chart.js
- How to change the z-index of chartjs annotations label?
- Display JSON data in react-chartjs-2
- annotation line not visible in scatter chart in chartjs
- Tooltips not working in chart.js. Any ideas?
- How can I automatically wrap tooltip text content to multiple lines?
- How could be the best way of implementing a 3D fft chart?