Reputation: 89
In amcharts v4, colors of slices of PIE repeats after 10 or so colors. Its like they have a spectrum of colors and they only use those and repeat when they are done. I want unique colors for all the slices without creating colors manually. Need help if possible with amcharts or how to create random and unique colors for slices which looks better even if I have like 1000 or so slices
Upvotes: 1
Views: 284
Reputation: 16012
Actually, the pie chart colors are unique due to how the underlying ColorSet object works (you can log the slice color's hex values if you don't believe me). Every color is generated using rules defined in the ColorSet
properties and its stepOptions
and, unlike v3 where it generated completely random colors, the additional colors generated will be consistent on every chart load with the settings you defined and will be approximately similar with changes to brightness, saturation, etc of the exisitng colors or baseColor so that the new colors actually fit with the existing theme/color list.
Of course, you can only go so far depending on the settings you specify and the amount of data you use as even the color rules will likely generate colors that are extremely similar after a while, so common sense applies as well with regard to data size and choice of chart type; I'd be hard pressed to argue that a 1000 slice pie chart is remotely usable from an overall UX perspective, but that's just me. If you really want fully unique colors for your 1000 slice chart, you're better off manually defining your own color list of 1000 colors and assigning it to the pie's series. There are plenty of algorithms and libraries you can use to generate this list yourself.
Upvotes: 1