Showing tooltip programmatically

446 views
Skip to first unread message

craig...@gmail.com

unread,
Jun 28, 2014, 1:09:02 PM6/28/14
to c3...@googlegroups.com
Hi,

Would really like to be able trigger the display and position of the tooltip through the API. Or at least have it show at given x-position once the data is loaded.

Is there a way I can achieve this?

Cheers,
Craig

Masayuki Tanaka

unread,
Jun 29, 2014, 9:07:35 AM6/29/14
to c3...@googlegroups.com
Hi,

Tooltip can be shown when chart rendered. Please try this code:
c3.generate({
...
tooltip
: {
  init
: {
    show
: true, // show tooltip when chart rendered
    x: 4,       // use data on x = 1 as tooltip content
    position
: { // set position of tooltip
      top
: 100px,
      left
: 200px
   
}
 
}
},
...
});

As you said, an API for showing tooltip would be needed. So I'll add later. Thanks.

craig...@gmail.com

unread,
Jun 30, 2014, 11:38:45 AM6/30/14
to c3...@googlegroups.com
Thanks!

Just a note that the position values actually need to be quoted, and it would be very useful if one could also specify "right" and "bottom".

Cheers,
Craig

ken...@gmail.com

unread,
Aug 2, 2016, 4:53:18 PM8/2/16
to c3js
Is there a way to use the tooltip.position fn on initial render? I set my own position fn, but it is not used when I pass :init {show: true, x: 1}.

is i add position: my-position-fn to that map, it fails.
Reply all
Reply to author
Forward
0 new messages