chartjs random color line
const r = Math.round (Math.random () * 255);
const g = Math.round (Math.random () * 255);
const b = Math.round (Math.random () * 255);
// some examples on where and how to use it
config.data.datasets.borderColor = `rgb (${r}, ${g}, ${b})`;
config.data.datasets.backgroundColor = `rgb (${r}, ${g}, ${b})`;
config.options.scales.yAxes.ticks.fontColor = `rgb(${r}, ${g}, ${b})`; function getRandomColor() {
var letters = '0123456789ABCDEF'.split('');
var color = '#';
for (var i = 0; i < 6; i++ ) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
Also in JavaScript:
- what is angularjs
- how many threads does node js use
- javascript sort array of ints
- jquery tag name
- webpack css not shoud be empty
- reactjs web3 components
- angular scroll to element horizontally
- sorting array from highest to lowest javascript
- unix timestamp to date javascript yyyy-mm-dd
- modal show jquery event
- find an object from array of objects javascript
- transition event listener does not work
- javascript onsubmit change input value
- js indexof string
- instanceof javascript
- how to find area of polygon with coordinates in javascript
- angular MatDialogRef spec
- print to console without newline nodejs
- javascript objet keys comparaison
- how to create an array in node js
- js hangman with repeated characters
- how to kill all node processes
- javascript go to page
- canvas fillrect