You can try add this code.
var clicktip='<div id="fonttest"> <a href="test2.html"
onclick="info()">hellow</a> </div>';
var data = google.visualization.arrayToDataTable([
['Genre', 'Percentage of my books',*{role: 'tooltip', type:
'string', p: {html:true,trigger:'selection'}*}],
['Science Fiction', 217,clicktip],
['General Science', 203,clicktip],
['Computer Science', 175,clicktip]
]);
var options = { tooltip: { isHtml:true,*trigger: 'selection'}*};
chart.setAction({
id: 'id',
text: 'click',
action: function() {
alert('success');
}
});
chart.draw(data, options);
If you are working on Piechart it works, but I tried on Timeline it failed
to read setAction() function.
On Tuesday, May 3, 2016 at 3:28:48 PM UTC-4, Naresh Maruthi Jayaraman wrote:
>
> Hi all,
>
> I am having a google chart with tooltip on hover over charts. I am trying
> to have a export button in the tooltip which just exports the current
> selection of the whole chart.
>
> How should i trigger an event when user clicks on export link in the
> tooltip?
>
> Note: I want to capture the event only if the user clicks that button in
> the tooltip not when the user selects the barchart!
>
> I have this in options and chart.setAction. Also i couldnt do action in
> setAction and isHTML: true together. Thoughts on that would also be helpful.
>
> tooltip: {
> isHtml: true,
> trigger: 'both'
> },
>
> chart.setAction({
> id: 'sample',
> text: 'Export data',
> enabled: function() {
> var selection = chart.getSelection();
> // some code
> }
>
> Thanks!!
>
--
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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/d0c0f8b0-232e-47e5-a9b6-58ae5b1024ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.