OK, here's an extraordinarily hacky solution. Because we're reading the
DOM, this solution actually *requires* that all of the labels are visible
and not truncated, so that you can sanely correlate them with your data. So
in its current state, this solution would not be usable for rects with very
long names, or rects that wind up being small. Also, due to the use of
querySelector in this solution, it does not support IE8. It could be
rewritten to not use it, or you could use jQuery to provide that.

All that said, here is the hack: https://jsfiddle.net/esb8twwe/
The trick here is that each rectangle in the treemap is going to be an SVG
'g' element (group), with exactly one rect and exactly one text element. So
we can simply iterate over all the groups in the SVG element, and filter
out all the ones that don't fulfil this requirement. Then, the text content
of the 'text' element is the label, and the bounding box of the 'rect'
element is the rectangle.

Please keep in mind that the DOM structure might change in future versions
without any warning, and so your chart may break with some future release.

On Fri, Jul 24, 2015 at 11:17 AM <[email protected]> wrote:

> Yes, please :)
> I know using DOM isn't the best solution, but I think we don't have choice
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to