I have to make charts for a list of components(on y axis). I am using HighCharts. This is how a part of my javascript code looks like when I am trying to prepare the chart:
series: $.map(data, function (row) {
return ({
name: component,
data: data,
color: getRandomColor()
})
}
getRandomColor
well, gets a random hexcode. Everything works fine. The problem is instead of the colors being random, I want them to be fixed with each component. One way is to hardcode a map, but I, being lazy, am trying to avoid it. Second, is hash the component string and use that as a seed in my getRandomColor function but the components are actually very similar strings (both forward and reverse), hence, the color range obtained is very small.
Is there an elegant way or a 'HighCharts' way in which I can fix a color with a component?