[visualization-api] Re: HTML Tooltip Position in scatter chart

2015-08-13 Thread Shravan Kumar
Do you know how can I extend this to a Sankey diagram? I did change the 
element name to my sankey div; but it does not seem to work for that.

On Thursday, 7 August 2014 02:22:34 UTC-7, Ishwar wrote:

 Thanks a lot @Andrew, it worked like a charm

 var chart = new 
 google.visualization.ScatterChart(document.getElementById('chart_div'));

 google.visualization.events.addOneTimeListener(chart, 'ready', function () 
 {
 var container = document.querySelector('#chart_div  div:last-child');
 function setPosition () {
 var tooltip = 
 container.querySelector('.google-visualization-tooltip');
 tooltip.style.top = parseFloat(tooltip.style.top) + 15;
 tooltip.style.left = parseFloat(tooltip.style.left) - 15;
 }
 if (typeof MutationObserver === 'function') {
 var observer = new MutationObserver(function (m) {
 for (var i = 0; i  m.length; i++) {
 if (m[i].addedNodes.length) {
 setPosition();
 break; // once we find the added node, we shouldn't 
 need to look any further
 }
 }
 });
 observer.observe(container, {
 childList: true
 });
 }
 else if (document.addEventListener) {
 container.addEventListener('DOMNodeInserted', setPosition);
 }
 else {
 container.attachEvent('onDOMNodeInserted', setPosition);
 }
 });
 chart.draw(data, options);
 

 On Wednesday, August 6, 2014 5:04:40 PM UTC+5:30, Ishwar wrote:

 I am implementing html tooltip in scatter chart. Is there any way to 
 define tooltip position in scatter chart, i.e. near to cursor ?



-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.


[visualization-api] Re: HTML Tooltip Position in scatter chart

2014-08-07 Thread Ishwar
Thanks a lot @Andrew, it worked like a charm

var chart = new 
google.visualization.ScatterChart(document.getElementById('chart_div'));

google.visualization.events.addOneTimeListener(chart, 'ready', function () {
var container = document.querySelector('#chart_div  div:last-child');
function setPosition () {
var tooltip = 
container.querySelector('.google-visualization-tooltip');
tooltip.style.top = parseFloat(tooltip.style.top) + 15;
tooltip.style.left = parseFloat(tooltip.style.left) - 15;
}
if (typeof MutationObserver === 'function') {
var observer = new MutationObserver(function (m) {
for (var i = 0; i  m.length; i++) {
if (m[i].addedNodes.length) {
setPosition();
break; // once we find the added node, we shouldn't 
need to look any further
}
}
});
observer.observe(container, {
childList: true
});
}
else if (document.addEventListener) {
container.addEventListener('DOMNodeInserted', setPosition);
}
else {
container.attachEvent('onDOMNodeInserted', setPosition);
}
});
chart.draw(data, options);


On Wednesday, August 6, 2014 5:04:40 PM UTC+5:30, Ishwar wrote:

 I am implementing html tooltip in scatter chart. Is there any way to 
 define tooltip position in scatter chart, i.e. near to cursor ?


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.


[visualization-api] Re: HTML Tooltip Position in scatter chart

2014-08-06 Thread Andrew Gallant
Controlling the position of the tooltip is not easy.  I wrote up an answer 
on StackOverflow that attempts to do 
this: 
http://stackoverflow.com/questions/24795432/how-to-change-pop-up-location-of-google-charts-tooltip/24807496#24807496

It may be easier to turn off the API's tooltips and use your own custom 
tooltips instead.  You can hook up an event handler to the onmouseover 
and onmouseout events that the chart throws, and spawn or destroy 
tooltips as appropriate.

On Wednesday, August 6, 2014 7:34:40 AM UTC-4, Ishwar wrote:

 I am implementing html tooltip in scatter chart. Is there any way to 
 define tooltip position in scatter chart, i.e. near to cursor ?


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.