Assign a color to every value in Javascript using HighCharts -
I have to make a chart for a list of components (on the y axis). I am using hiccorts. When I'm trying to prepare charts, a part of my JavaScript code looks like this:
series: $ .map (data, function (line) {return ({name: component) , Data: Color: getRandomColor ()}}
getRandomColor
is OK, it gets a random hexcode.Some works well. I want to decide with the component. One way to hardcode a map, but I'm lazy, try to avoid it. Second, the hash component is string and it is used as a seed in my getRandomColor function components are actually very similar strings (both forward and reverse), therefore, the color range is very low. Great way or 'high card' in which I can fix the color with one component?
As Rhine pointed out, multiply hash by expanding two or three boundaries Received and he worked for me.
Comments
Post a Comment