React-vis: Treemap Color not Working

Created on 17 Oct 2018  路  2Comments  路  Source: uber/react-vis

Greetings! I'm having trouble getting the color passed into the Treemap via the data object to work properly. I have tried passing it in as:

  • "color": "#HEXCODE"
  • color: "#HEXCODE"
  • "color": "rgb(r, g, b)"
  • color: "rgb(r, g, b)"

but no matter what I try, it always comes out black. I've also tried passing it in via the getColor method, but same story. I am able to fake the colors by passing in the size of the object, which gives me anywhere between orange and yellow, I can't use my custom colors. In fact, it seems the documentation website is also having issues with custom colors on the colors section (scroll to the linear and categorical colors sections, you'll see what I mean).

I've been using the dummy data you provide in the treemap section of the documentation site, so I'm confident it's not anything I have done incorrectly.

Any help in this would be appreciated, however I am on a timetable and I need a working customizable treemap within the week.

bug question

Most helpful comment

Sorry for the delayed response, but adding colorType={'literal'} / colorType='literal' seemed to do the trick, thanks!

All 2 comments

Hey @Tenurian,

I suspect you may need to set the colorType prop on Treemap to be colorType="literal". You raise a good point about the colors section, I'm not sure what's up with that, but i don't think it's related to your treemap bug. @jckr do you wanna take a look at the color article?

Sorry for the delayed response, but adding colorType={'literal'} / colorType='literal' seemed to do the trick, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ZKruse picture ZKruse  路  4Comments

Falieson picture Falieson  路  3Comments

stroemdev picture stroemdev  路  4Comments

codewithsk picture codewithsk  路  5Comments

cvalmonte picture cvalmonte  路  4Comments