score:3
Accepted answer
You can piggy back on the showTooltip method, like so
...
var myDoughnutChart = new Chart(ctx).Doughnut(data);
var originalShowTooltip = myDoughnutChart.showTooltip;
myDoughnutChart.showTooltip = function (activeElements) {
$("#dc_LoadTime").css("cursor", activeElements.length ? "pointer" : "default");
originalShowTooltip.apply(this, arguments);
}
score:0
For me this worked
onHover: (event, chartElement) => {
event.target.style.cursor = chartElement[0] ? 'pointer' : 'default';
}
Add this inside your options like
options = {
responsive: true,
maintainAspectRatio: false,
cutoutPercentage: 75,
aspectRatio: 1.5,
// show pointer while hovering
onHover: (event, chartElement) => {
event.target.style.cursor = chartElement[0] ? 'pointer' : 'default';
},
};`
score:21
In chartjs 2.0 < 2.5 I use hover in option section of the chart, like this:
options: {
hover: {
onHover: function(e) {
$("#id-of-your-canvas").css("cursor", e[0] ? "pointer" : "default");
}
}
}
...and here is a complete example: https://jsfiddle.net/su5fgb5h/5/
In version 2.5 onhover callback has changed and we need second parameter to change cursor:
options: {
hover: {
onHover: function(e, el) {
$("#id-of-your-canvas").css("cursor", el[0] ? "pointer" : "default");
}
}
}
Source: stackoverflow.com
Related Query
- How to to change mouse cursor on chart.js doughnut graph?
- angular-chart.js doughnut chart : How do I change width of the arc of a doughnut?
- Chartjs - how to change the notation of doughnut chart
- How can I change the cursor on pie chart segment hover in ChartJS 3?
- How to change bar color on a angular-chart and chart js bar graph with multiple datasets?
- How to add text inside the doughnut chart using Chart.js?
- Chart.js how to show cursor pointer for labels & legends in line chart
- How to add text in centre of the doughnut chart using Chart.js?
- Chart js. How to change font styles for "labels" array?
- How do I change the 'months' language displayed on the date axis in Chart JS?
- How to change the cursor to a pointer when I hover over a bar in a ChartJS bar chart?
- How to display the labels in doughnut chart using ng2 charts?
- How to change line segment color of a line graph in Chart.js?
- How to create single value Doughnut or Pie chart using Chart.js?
- How to use 'time' (data from database, data type: timestamp ) for plotting graph in Chart JS
- Chart.js: How can a line series (out of many) change line color and thickness upon mouse hover?
- How to change cursor style to pointer on hovering over points of the chart?
- How to start the line graph from the left Y axis in a line/bar mixed chart (Chart.js)?
- How can I add some text in the middle of a half doughnut chart in Chart.JS?
- How to change Chart.js horizontal bar chart Width?
- How to change z-index of chart js tooltip?
- How to add title inside doughnut chart in Angular Chart?
- how to change color of bar if its goes above avg score in mixed graph chart.js
- How to access or get value of specific graph on chart plot by click event?
- how to customize tool tip while mouse go over bars on Chart js bar chart
- Change mouse cursor to pointer in charts js
- How to change the label and grid line position on a timeseries chart in Chart.js 3?
- How to change Doughnut color to linear gradient on ChartJS?
- How to change color of column in chart js
- How change chart height in chart.js
More Query from same tag
- Creating charts dynamically using ChartJS and AngularJS
- Charts.js is automatically adding comma as thousands separator when it shouldn't
- Chartjs v2.0: stacked bar chart
- Why don't my datasets show up on line graph using Chart.js?
- ChartJS vertical bar chart - measure percentage of the data in each column based on a specified max
- When using chart.js to draw a line chart, if the peak is between two x values instead of "at a x value"
- Graph is not displayed
- Type 'import("/@types/chart.js/index.d.ts")' is missing the following properties from type 'any[]': length, pop, push, concat, and 26 more
- Chart.js legend position error
- Datetime picker in Chart.js
- chartJS line chart not plotting values that are less than minY
- Setting min and max values chart.js
- Call ChartJS details in main Javascript file
- <Canvas is already in use. Chart with ID '18' must be destroyed before the canvas can be reused> in react
- ChartJs - Doughnut Chart - how to remove labels if percentage is less than a limit
- Integrating TideSDK with C *.dll
- Set different color for each bars using ChartJS in Angular 4
- ChartJS Stacked Group with labels on each bars
- Determining which chart the user has clicked on
- Chart.js: Force display of a certain label with autoSkip: true
- html-pdf: How to ensure image doesn't span a page break
- Add space Between Columns in Bar chart. chartjs
- Chart.js stacked bar chart text on top of the stacked bars
- How to collect values of object properties into a list?
- How to set static value in y-axis in chart.js?
- Trying to access key in JSON array
- Charts .js update when array changes
- Ember.Computed is not a function
- ChartJs - Round borders on a doughnut chart with multiple datasets
- Chartjs + moment() not displaying on django