-
Notifications
You must be signed in to change notification settings - Fork 260
Solution for issue #5 about custom colors #22
Conversation
Haven't reviewed yet but you will need to resolve the conflicts first |
…athjs-charts # Conflicts: # README.md # example/data.js
I think done |
I made an interesting discovery that multi-color support was already baked into the react-pathjs-chart library which this charting lib is based on via the use of the You can see a working example of this by making a one-line change to the Pie chart source here to change Here's a working example:
which yields this: Given all of this discovery of the |
Ok thAnks |
Why should I change
Does it work? Anyway, it would be nice to pass color in the data array, like a property of the data object (name, population, color). Thank you for your reply |
That's a fair point. Your example works and it shows TMTOWTDI (There's More Than One Way To Do It). I was thinking specifying colors in the options property was more consistent with the way other chart options were handled in this library but you bring up two additional possibilities that I hadn't considered:
Yet another idea is a hybrid approach of using a palette of colors in the chart options (like I originally proposed) (for cases when you don't care what sections of the pie chart get what colors) and then use your idea of specifying the desired color with each data item as a possible way to override each item. Does that make proposal make sense? What do you think of that idea? |
Yes, all are valid points. In my opinion it would be important and useful to have the chance to bind a specific color to each data item (to each section of the pie), in order to build a legend or whatever linked to the items. Thank you |
If this approach looks good for you, can use it for custom colors settings...