'HighStocks series does not show line on Black Colors
let code = Math.floor(Math.random() * 16777215).toString(16);
if (code === "000000" || code === "ac132") {
code = Math.floor(Math.random() * 16777215).toString(16);
}
let colored = '#' + code;
let dataset = {
label: value.name,
name: value.urls.name,
color: colored,
stickyTracking: true,
showInNavigator: true,
visible: true,
data: value.values,
dataGrouping: {
enabled: false,
}
};
And also the legend gets weird with black, covers the whole space and does not show other series properly, it only happens with black colors and its combinations.
I am using Highstock JS v9.2.2 (2021-08-24)
Here is the fiddle with one sample color code Fiddle link
Solution 1:[1]
As mentioned by @ppotaczek the color code is invalid hex format.
New javascript code to create random colors
let code = "#000000".replace(/0/g,function(){return (~~(Math.random()*16)).toString(16);});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Saad Mirza |