Customize the content in a Map chart with Google visualization - HTML

75 views
Skip to first unread message

Marcela Moreno

unread,
Oct 30, 2015, 11:59:46 AM10/30/15
to Google Visualization API
Hello,

I have a google.visualization.Map chart. The Datatable for that chart has 3 columns and I want that the third one works like a 'tooltip' with HTML format.

My data is something like :

[1,2,'"<div>marcela</br>moreno</br>5000<div>]

and I set the column property with this: this.data.setColumnProperty(2, 'role', 'tooltip'), even with this this.data.setColumnProperty(3, {type:'string', role:'tooltip', html:true});
and set the map options like:

var options ={
 ....other options,
 tooltip:{isHtml:true}
}

But even those configurations, The tooltip content is still a string. So, all of html tags are showed in the toottip.

I don't know if tooltip role doesn't work in Map chart.

The other approach is try to change the InfoWindow that appears when I click in any point of the map, but all the documentation  I had founded is with Google Maps API and I'm using Google visualization.

So, I'd really appreciated any help with this issue I have.


Thanks a lot.

Marcela

Sergey Grabkovsky

unread,
Nov 2, 2015, 9:46:51 AM11/2/15
to Google Visualization API
Hi Marcela,

The tooltip role is not supported by the Map visualization, but this is only because the Map visualization should automatically use the third column as a tooltip and process the HTML, no special options required. Here's an example: http://jsfiddle.net/8ttds5jv/

--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/3662bbbf-1526-44a3-a469-7cde49f4df38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
unnamed.gif 
Sergey Grabkovsky | SWE  | gra...@google.com

Marcela Moreno

unread,
Nov 2, 2015, 11:20:15 AM11/2/15
to google-visua...@googlegroups.com
Thanks for your answer.

Is it possible to remove the tooltip when hover marker and leave the tootlip appears when click it in?

I'd appreciated your help.

Marcela


--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/djGuF3P88vc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.



--
July Marcela Moreno Gómez
Software Engineer
IT Project Management
Belfast, NI

Sergey Grabkovsky

unread,
Nov 2, 2015, 11:22:36 AM11/2/15
to google-visua...@googlegroups.com
I believe the tooltips in the Map visualization are only available when you click. This is inherited from the Google Maps behavior (since that's what we use to draw the map, markers, and tooltips). If you find some documentation or an example of a Google Map displaying its tooltips on hover, please link to it and we will integrate it when we have time.


For more options, visit https://groups.google.com/d/optout.

Marcela Moreno

unread,
Nov 2, 2015, 5:04:58 PM11/2/15
to google-visua...@googlegroups.com

​Hi,

​In the example you sent me, if you hover the mouse on the market a tooltip appears without processing the HTML
So, I wonder how can I remove the tooltip to avoid to show the HTML tags?

Thanks​

Inline image 1

Marcela


Sergey Grabkovsky

unread,
Nov 2, 2015, 5:11:20 PM11/2/15
to google-visua...@googlegroups.com
Oh. You're talking about the actual tooltip. Sadly, I don't believe you can process the HTML there. It's a system tooltip, so I'm not even sure that browsers expose everything we would need to actually do it.


For more options, visit https://groups.google.com/d/optout.

Marcela Moreno

unread,
Nov 3, 2015, 3:10:19 AM11/3/15
to google-visua...@googlegroups.com
​Ok!! Seems I don 't have solutions :(

Then, Can I handle the Click event to change the tootlip content for Map chart from google visualization?​

Any ideas?

Thanks a lot

Marcela


For more options, visit https://groups.google.com/d/optout.

Sergey Grabkovsky

unread,
Nov 3, 2015, 9:53:04 AM11/3/15
to google-visua...@googlegroups.com
Well it wouldn't be pretty, but you could listen for the 'select' event, swap out the tooltip content, and then redraw the map and setSelection() (since redrawing will lose the selection). However, when a tooltip is present, the user could still hover over the marker and make the text appear, so I don't think there's any way to get around this behavior outside of using the Google Maps API directly.


For more options, visit https://groups.google.com/d/optout.

Marcela Moreno

unread,
Nov 3, 2015, 10:42:25 AM11/3/15
to google-visua...@googlegroups.com
​Sergey, Thank you very much. We'll see what should be the best approach for this problem we have according your suggestions.

I'd appreciate your help.

Marcela​


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages