Bubble Chart Tooltip and access to data table column data

118 views
Skip to first unread message

yzg...@gmail.com

unread,
Apr 17, 2014, 11:41:04 AM4/17/14
to google-visua...@googlegroups.com
Hi,
 
I am trying to create a customize tooltip for the bubble chart because I do not want to show all the columns in the data table like the default table does.  I created a mouseover event and its working accept i do not know how to get to the data of the selected item?  I used the following example to create the mouseover function from an exmaple i found.  My bubblechart is called chart.  So how would i get to the chart data table from this function?
 

function handler1(e) {

var x = 350;

var y = 500;

var a = 1;

var b = 2;

$('#custom_tooltip').html('<div>Value of A is' + a + ' and value of B is' + b + '</div>').css({

'top': y,

'left': x,

'width': 250,

}).fadeIn(1000);

}

Sergey Grabkovsky

unread,
Apr 17, 2014, 11:49:02 AM4/17/14
to google-visua...@googlegroups.com
chart.getSelection() should do what you want.

- Sergey


--
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.
For more options, visit https://groups.google.com/d/optout.

Andrew Gallant

unread,
Apr 17, 2014, 2:11:21 PM4/17/14
to google-visua...@googlegroups.com
This is mouseover, not selection, so #getSelection won't work.  The event passes an object with a "row" property that you can use to reference the appropriate data:

function handler1(e) {
    if (e.row >= 0) {
        var x = 350;
        var y = 500;
        var a = data.getValue(e.row, 0);
        var b = data.getValue(e.row, 1);
        
        $('#custom_tooltip').html('<div>Value of A is' + a + ' and value of B is' + b + '</div>').css({
            'top': y,
            'left': x,
            'width': 250,
        }).fadeIn(1000);
    }
}

On Thursday, April 17, 2014 11:49:02 AM UTC-4, Sergey wrote:
chart.getSelection() should do what you want.

- Sergey


On Thu, Apr 17, 2014 at 11:41 AM, <yzg...@gmail.com> wrote:
Hi,
 
I am trying to create a customize tooltip for the bubble chart because I do not want to show all the columns in the data table like the default table does.  I created a mouseover event and its working accept i do not know how to get to the data of the selected item?  I used the following example to create the mouseover function from an exmaple i found.  My bubblechart is called chart.  So how would i get to the chart data table from this function?
 

function handler1(e) {

var x = 350;

var y = 500;

var a = 1;

var b = 2;

$('#custom_tooltip').html('<div>Value of A is' + a + ' and value of B is' + b + '</div>').css({

'top': y,

'left': x,

'width': 250,

}).fadeIn(1000);

}

--
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-visualization-api+unsub...@googlegroups.com.

Sergey Grabkovsky

unread,
Apr 17, 2014, 3:07:34 PM4/17/14
to google-visua...@googlegroups.com
Oh I see, my apologies, there is no way to get the currently hovered-over datum, and unfortunately, the bubble chart does not yet allow for custom tooltip content.

- Sergey


To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.

Andrew Gallant

unread,
Apr 17, 2014, 5:10:02 PM4/17/14
to google-visua...@googlegroups.com
According to the docs, the mouseover events should be passing row information.

- Sergey



- Sergey


To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages