1

This might actually just be an HTML/JS implementation question, but couldn't find anything about it. I'm displaying an unknown number of series, and each series has a unique coloring. However, it seems that I need to hard-code in an array of colors to use for this. For instance, right now I'm using the array [red, blue, green, orange] but this means I can only have up to 4 series. I could also do something with the RGB values such as rgb(20+3*n...) but this makes every 2 colors similar. Is there a way to automatically get a unique color set without hard-coding it?

Booley
  • 819
  • 1
  • 9
  • 25
  • What defines "not similar"? Given an large enough number of series they will eventually fall under "similar". – Halvor Holsten Strand Mar 25 '15 at 14:45
  • 2
    You might want to look at some of the difficulties of generating different colors here: [How to automatically generate N “distinct” colors?](http://stackoverflow.com/q/470690/2732991) – Halvor Holsten Strand Mar 25 '15 at 14:50
  • 1
    I would say that your best bet is to define a larger array of whatever number of colors you are comfortable with, which will give you the ability to determine that the colors are appropriate. If you are going to have a very large number of series (20, 30, etc...), and want every color to be dissimilar, your quest is basically not possible and you'll need to rethink the purpose and method of the visualization. – jlbriggs Mar 25 '15 at 17:06

0 Answers0