Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

HTML tooltips #338

Closed
carueda opened this issue Sep 23, 2014 · 17 comments
Closed

HTML tooltips #338

carueda opened this issue Sep 23, 2014 · 17 comments

Comments

@carueda
Copy link

carueda commented Sep 23, 2014

This is about allowing html in token tooltips (complementing what the current 'title' does with only text), and on groups. I know there are some "tooltip" entries already but I was not sure whether any of them is for the timeline component; feel free to mark this as duplicate if that's the case. Thanks.

@josdejong
Copy link
Contributor

Yes, HTML tooltips would be nice. Like Network already has.

@sekys
Copy link

sekys commented Sep 24, 2014

I used qTip library for tooltips at Timeline items. I am using Timeline 2.8 version, this code works for me:

 $(document).on("mouseenter", '.timeline-item', function ($e) {
        $(this).qtip({
            overwrite: false,
            hide: 'unfocus',
            show: 'click',
            content: {            }
        });
    });

@josdejong
Copy link
Contributor

Thanks for sharing Lukas.

@carueda
Copy link
Author

carueda commented Oct 6, 2014

Yes, thanks for the tip Lukas. I may consider using it, but I'm trying to avoid/minimize extra dependencies, and some of my applications are not relying at all on jQuery.

@ovalek
Copy link

ovalek commented Oct 17, 2014

I tried bootstrap popover (bootstrap version 3.2.0), and it worked quite well, except that sometimes the popover "arrow" wasn't where it supposed to be. If item was partially hidden, popover it self was nicely visible, but the "arrow" was hidden. There were more problems with the popover "arrow", so now I'm trying qTip2. As for now it only works well on fully visible items. But there are a lot of various options related to positioning, so I hope I'll find out. Do you have any experiences with that?

What I would like to achieve:
If an item is fully visible - show tooltip at bottom center.
If an item is partially hidden from left - show tooltip at bottom right.
If an item is partially hidden from right - show tooltip at bottom left.

@SciGno
Copy link

SciGno commented Oct 31, 2014

@Skylinex
Do you have an example on how to add a Bootstrap popover to an item?

Thanks

@ovalek
Copy link

ovalek commented Nov 1, 2014

Well it is not the best solution, but it works. Inside item's content I have span with attribute data-content, which contain future popover content. And then:

jQuery(document).ready(function($) {
// enable timeline, then:
    timeline.on('rangechange', function(properties) {
        $('#timeline .item').popover('destroy');
        attachPopover();
    });
    timeline.on('timechange', function(properties) {
        $('#timeline .item').popover('destroy');
        attachPopover();
    });

    $('a').on('mouseup', function(event) {
        $('#timeline .item').popover('destroy');
        attachPopover();
    });

    var attachPopover = function() {
        $('#timeline .item').popover({
            template: '<div class="popover timelineItemPopover" role="tooltip"><div class="arrow"></div><div class="popover-head"><a href="#" class="btn btn-sm glyphicon glyphicon-remove-circle popover-close"></a><h3 class="popover-title"></h3></div><div class="popover-content"></div></div>',
            placement: 'bottom',
            container: '#timeline',
            viewport: { selector: '#timeline', padding: 20 },
            html: true,
            content: function() {
                return $(this).children('.content').children('span[data-content]').attr('data-content');
            }
        });

    };

    attachPopover();

    $('#leMain').on('click', '.popover-close', function(event) {
        event.preventDefault();
        $(this).closest('.popover').popover('hide').remove();
    });
});

Replace #leMain with body or with some other #timeline container.

@SciGno
Copy link

SciGno commented Nov 1, 2014

@Skylinex
Thanks a lot for the quick reply. I'll give it a try.

@mcshaman
Copy link

mcshaman commented Dec 5, 2014

I also would like to see an option for tool tips. I tried to implement one with CSS :hover but found some limitations to the size and position as they can get cut off by the timelines hidden overflow.

@AlexDM0
Copy link
Contributor

AlexDM0 commented Jan 9, 2015

Hi,

Over the last year a lot of feature requests have been made. We have just introduced our new website which has a list of the requested features. We have placed this request on that list.

The list can be found here:
http://visjs.org/featureRequests.html

An explaination of the new system can be found here:
http://visjs.org/blog.html#New\ website\ for\ vis.js!

I would like to stress that this does not mean we abandon this request. Discussion here will continue if needed on this feature but we will close it to keep our Github issue page more of a bug-todo list.

Future feature requests will still be made here and then added to the website by us.

Regards,

Alex

@AlexDM0 AlexDM0 closed this as completed Jan 9, 2015
@jasontibbitts
Copy link

I just happened to need this and ran across this closed issue. I managed to get something that at least works for my use case. Just pull in jquery and powerTip, do

$('.group .item').powerTip({placement: 'se', smartPlacement: true, mouseOnToPopup: true});

(or whatever selector you need to get the items you want) and then the title property on every element can be any HTML you want. I'm doing a little security camera system and the elements on the timeline are videos. The tooltips display small versions of the videos, with controls and everything. Seems to work fine, even with zooming and scrolling.

Maybe this is trivial or pointless, since I don't really know what I'm doing, but at least I have something going.

@jasontibbitts
Copy link

Meh; this for some reason doesn't work if you call setGroups, even if you just initially set up the timeline that way. It doesn't appear that the structure of the elements changes if you do that, and powerTip attaches the events to all of the items properly, but either the tooltip doesn't fire, or it fires and the title tooltip appears. Looks like I need to find another way to do what I wanted to do.

@sekys
Copy link

sekys commented Apr 6, 2015

Hello jason, well this is not working because you are selecting existing items. For you and all, i suggest use "bind" function. Then you are selecting existing and future-existing elements. Good luck

@jasontibbitts
Copy link

Thanks for the hint. I'm not sure that powertip code exposes a way to use bind; it appears to traverse the selected elements itself and attaches events with this.on(). Though, it does allow that to be overridden. I'll have to see why it does appear to attach events to new elements but doesn't manage to get its tooltip magic correct.

@phamtuananh791994
Copy link

Are any solution for this ?

@mojoaxel mojoaxel changed the title timeline: tooltip with html? HTML tooltips Oct 24, 2016
@mojoaxel
Copy link
Member

Reopening as Feature-Request issue (see #2114).
Everybody: Please feel free to implement this!

@mojoaxel mojoaxel reopened this Oct 24, 2016
@yotamberk yotamberk self-assigned this Oct 26, 2016
@yotamberk yotamberk added this to the Minor Release v4.18 milestone Dec 23, 2016
@yotamberk yotamberk removed their assignment Dec 23, 2016
@yotamberk
Copy link
Contributor

Added to the next release with #2498. Thanks @lewisjb!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests