Pad random color to be 6 hex characters

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
Mcat12
2018-06-16 15:09:54 -04:00
parent b5e1350b0f
commit fd3abdbc35
+1 -1
View File
@@ -56,7 +56,7 @@ class ClientsGraph extends Component {
// If we ran out of colors, make a random one
backgroundColor: i < colors.length
? colors[i]
: '#' + parseInt("" + Math.random() * 0xffffff, 10).toString(16),
: '#' + parseInt("" + Math.random() * 0xffffff, 10).toString(16).padStart(6, "0"),
pointRadius: 0,
pointHitRadius: 5,
pointHoverRadius: 5,