0

Is there a way to show a tooltip for a pre-specified shape on chart initiation for a specific period of time? The item could be random or hard coded.

user3359706
  • 511
  • 1
  • 5
  • 16
  • You can use `setTimeout` to make the tooltip disappear. – Lars Kotthoff May 26 '14 at 12:31
  • Thanks, how do I initially trigger the mouse over event on page load without actually doing a mouse-over? – user3359706 May 26 '14 at 13:10
  • Just run the code you run in the mouseover handler directly. – Lars Kotthoff May 26 '14 at 13:12
  • I'm using this line for tooltip. plot.append("title").text(function (d) { return d.description; }); I could check if (description === "myitem") but how do I activate the tooltip? Just for that item on page load? – user3359706 May 26 '14 at 14:11
  • Just run this line where `d` is the datum bound to the item you want to show the tooltip for. – Lars Kotthoff May 26 '14 at 14:39
  • I'm still confused! This will selectively enable a tooltip for 'myitem' but I want the tooltip to show even before mouse-over and then timeout as you mentioned earlier. Is this possible? – user3359706 May 26 '14 at 14:49
  • Yes. You are running code in the mouseover handler to show the tooltip. Take that same code from the handler and run it at the start. – Lars Kotthoff May 26 '14 at 15:01
  • I'd like the cursor position on page load to be on the shape and trigger the mouse over but how do I set the x,y coordinates to make this happen? Is there an easier way? Here is my working fiddle example with tooltip: http://jsfiddle.net/sjp700/L72Hq/ – user3359706 May 26 '14 at 18:40
  • Found something similar to what I'm trying to do. But the linked code is static. http://stackoverflow.com/questions/7136115/d3-js-tipsy-tooltips. Is this straight forward to achieve? – user3359706 May 26 '14 at 21:29
  • I'm not getting any tooltips in your jsfiddle... – Lars Kotthoff May 27 '14 at 08:15
  • The tooltip should show the section on mouseover any rectangle. It seems to work okay for me! – user3359706 May 27 '14 at 10:15

0 Answers0