d3plus / d3plus-viz

Abstract ES6 class that drives d3plus visualizations.
MIT License
7 stars 2 forks source link

override the predefined colors #139

Open nalhadad opened 4 years ago

nalhadad commented 4 years ago

Hello, In d3plus V1, for a TreeMap, I used to define arrays of colors that I use in the treeMap depending on my skin. I just needed to put this array in the .color() and my TreeMap takes these colors automaticlly like the following example

I can't find a way to use my arrays of predefined colors in V2. I can see that we can use functions but this isn't what I need. I need to override ur predefined colors for a treemap or a Pie. Can I do that in V2?

Thank you very much.

davelandry commented 4 years ago

let me know if this example helps: http://d3plus.org/examples/d3plus-hierarchy/custom-color/

nalhadad commented 4 years ago

Hello, I am trying to override your predefined colors in a pie/treemap. I need to use my own set of colors. My set of Colors are NOT RELATED TO THE DATA. I just need that the Treemap/Pie take my colors instead of your default colors. I tried to create a JS in the shapeConfig. You find My example here : https://jsfiddle.net/ubxLemfy/ It works but the legend donesn't correspond to the colors in the Treeamp/Pie, in my example, sweden is red in the pie while it is purple in the legend. Am I doing somethig wrong? is there another way to do it? In version 1 I just needed to add .color({"scale": [ Array of Colors]})