{"issue":{"title":"Dynamic color switcher","created_at":"2011-12-23T05:49:51Z","milestone":null,"user":{"id":742293,"login":"jbeasley6651","url":"https://api.github.com/users/jbeasley6651","avatar_url":"https://secure.gravatar.com/avatar/e9a8bff1c561921701eb3ceabea83e92?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"e9a8bff1c561921701eb3ceabea83e92"},"labels":[],"updated_at":"2011-12-23T08:18:23Z","state":"closed","id":2644841,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"closed_at":"2011-12-23T07:09:44Z","html_url":"https://github.com/mbostock/d3/issues/414","body":"Love the library, thanks alot!\r\n\r\nIf anyone has a chance could you please show me an example of how to make a dynamic color switcher \r\n\r\ni'm currently using \r\n\r\n     color = d3.scale.category20c();\r\n\r\nhttps://github.com/mbostock/d3/wiki/Ordinal-Scales#wiki-category20c\r\n\r\nthen \r\n\r\n     .style(\"fill\", function(d) { return color((d.children ? d : d.parent).name); })\r\n\r\nTo make sure the colors match the parent\r\n\r\nWhat i would like to see is how i can\r\n1 - Construct my own colors (that match)\r\n2 - Apply / switch the colors dynamically\r\n\r\nThanks in advance if anyone can help me :)\r\n\r\njbeasley6651\r\n\r\n","number":414,"url":"https://api.github.com/repos/mbostock/d3/issues/414","comments":2,"assignee":null},"comment":{"created_at":"2011-12-23T08:18:23Z","user":{"id":742293,"login":"jbeasley6651","url":"https://api.github.com/users/jbeasley6651","avatar_url":"https://secure.gravatar.com/avatar/e9a8bff1c561921701eb3ceabea83e92?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"e9a8bff1c561921701eb3ceabea83e92"},"updated_at":"2011-12-23T08:18:23Z","id":3258919,"body":"Thank you so much for that explanation. It works great!\r\n\r\nSorry for posting in the wrong spot. I will post in Google groups if I\r\nneed help again.\r\n\r\nGoogle groups is just so ugly and difficult to read I stay as far away\r\nas i can when possible!\r\n\r\nSent from my iPhone\r\n\r\nOn Dec 23, 2011, at 2:09 AM, Mike Bostock\r\n<reply@reply.github.com>\r\nwrote:\r\n\r\n> Joel, Please use the d3-js Google group for help. In this case, you need to specify a domain for the ordinal (categorical) scale. The domain is an array of strings corresponding to the node names. The first value in the domain will be mapped to the first color in the range, and so on.\r\n>\r\n> ---\r\n> Reply to this email directly or view it on GitHub:\r\n> https://github.com/mbostock/d3/issues/414#issuecomment-3258603","url":"https://api.github.com/repos/mbostock/d3/issues/comments/3258919"},"action":"created"}