Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google visualization treemap - how to create custom text?

I am creating a treemap to visualize code complexity in a codebase using the treemap tool provided by the google visualization api. By default, the text displayed in each node is the value of the ID column in the data. For my data set the ID is very long (file paths) so I'd like to only display the Filename (with the complexity in brackets if possible). Is there a way to specify an alternative text to display each treemap node?

like image 649
mikelong Avatar asked Feb 22 '26 12:02

mikelong


1 Answers

It turns out this is quite simple, all you need to do is give a value/format pair for the ID column.

[{v:'src/AppCore/3DAnisotropy', f:'3DAnisotropy'},  'src/AppCore',  0,  0],
like image 196
mikelong Avatar answered Feb 25 '26 01:02

mikelong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!