score:14
To change the data point's color and size on hover, you'll need to set pointHoverBackgroundColor
and pointHoverRadius
property (as needed) respectively for the dataset, like so ...
datasets: [{
...
pointHoverRadius: 5,
pointHoverBackgroundColor: 'red'
}]
ᴅᴇᴍᴏ
var ctx = $('#chart');
var myLineChart = new Chart(ctx, {
type: 'line',
data: {
labels: [1, 2, 3, 4, 5],
datasets: [{
label: '# of votes',
data: [1, 2, 3, 4, 5],
fill: false,
pointHoverRadius: 5,
pointHoverBackgroundColor: 'red'
}]
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<canvas id="chart"></canvas>
score:6
Answering an old thread as accepted answer didn't work for me for bar-chart using ChartsJS. May be that was older version or the question was not for bar-chart, not sure. The following works on v2.8 for bar-chart:
hoverBackgroundColor: 'red',
hoverBorderColor: 'blue',
hoverBorderWidth : '3'
Ref1 : https://www.chartjs.org/docs/latest/charts/bar.html#interactions
Ref2 : https://www.chartjs.org/docs/latest/configuration/elements.html#point-configuration
Hoping it may help someone like me.
Source: stackoverflow.com
Related Query
- Change point size and color on hover in chartjs
- Is there any way to change the font color and size of labels in Chartjs 3.0.0
- Change font size and font color in Chartjs Angular 5
- how to change size of point in ChartJS
- chartjs datalabels change font and color of text displaying inside pie chart
- Change point color on click using ChartJS
- How to change the color of legend in chartjs and be able to add one more legend?
- Chartjs Radar - Change color of end point labels
- ChartJS click on bar and change it's background color
- Change style of hover and tooltip in chartjs or ng2-charts
- Change background point color at runtime for angular ng2-charts / chartjs
- Can't change the default color and font size of labels in react-chartjs-2
- ChartJS - Size of the point doesn't change
- Chartjs disable color change on hover withouth disabling tooltips
- Change Chartjs label color on click without losing hover
- Chartjs change grid line color
- ChartJS - Different color per data point
- Change X and Y axis font color
- Change color of X and Y axis values in Chart.js
- chartjs show dot point on hover over line chart
- how to change background in chartjs and remove background lines?
- How to change the cursor to a pointer when I hover over a bar in a ChartJS bar chart?
- Chartjs change the specific label color in x axis in callback function
- Chart.js: How can a line series (out of many) change line color and thickness upon mouse hover?
- Changing color of specific chartjs point
- ChartJS -- How do I change scale color when I have to scales?
- Angular 8 & ChartJs change color in pie chart
- unable to add background color to the canvas using jspdf and chartjs
- Removing ChartJS 2 border and shadow from point style legend
- Change size of a specific point on a line chart in Chart.js
More Query from same tag
- Assigning a value to an object w/bracket notation
- how to show only each 15th x-labels in line chart chart.js in angular 6?
- Chart.js: Reverse bar chart with regular bars (Bottom to top instead of top to bottom)
- creating a dynamic number of charts using chart.js using angular
- Chartjs-plugin: How to add a different color to each label?
- Create multiple dynamic charts
- Drawing pie segment percentage in middle of doughnut with chartjs issue
- chart.js zeroLineColor does not work as expected
- Chart JS pass in custom data for points
- Chart.js v2 - combined stacked bar chart and 2 unstacked lines
- How to make the whole <canvas> element in Chart.js V3.7.0 display cursor as pointer on hover?
- Display ellipsis for null or empty values in the bar chart using Chart.js
- Changing the label of chart
- How to add data dynamically to primevue Line chart from vuejs3?
- Line Chart using Chart js with time data
- Problem with script src for Chart.js. The CDN for Chart.js funtions fine, so my code is ok. Somehow I'm not linking the file correctly
- destroy method implementation in pie chart chartjs
- Trying to use axios, vuejs and a dummy api for my chartjs and googlecharts (get requests only)
- Can't use a chart module with angularjs
- Issue with HTML2Canvas - Green overlay while exporting
- How to change fonts and axis labels for Chart.js image rendering with QuickChart?
- Grouped Bar Char in D3.js or Google Charts or Chart.js
- HTML how block elements to not go over footer etc
- How to change React chartjs-2 legend click functionality to hide all except the one clicked?
- Displaying dataset labels in Chart.js line graph
- Chart.js replace all data
- how to sort tooltip value in Chart.js
- how do I render PyChart.JS charts in web2py?
- Chart.js only displays font changes upon hover
- .destroy() generating error 'window.myChart.destroy()' is not a function