-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Timeline] Added HTML tool-tip support #2498
Conversation
|
Cool! thank you! Can you add an example? |
|
Done @yotamberk. |
yotamberk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so I've reviewed this and everything seems fine code-wise. The thing is, the position of the tooltip is not very comfortable in my opinions and it would be much better if it was controllable. The second thing is, you call it a tooltip, but you call it with a title in the item options. I find it confusing.
I approve this feature, and I think it should be further developed to have better control of the tooltip position and triggering (the tooltip should be able to be riggered by click too).
|
Thanks @yotamberk! |
|
@lewisjb I think there is still something weird with the location... I think I preferred it better the way it was before or with a margin of a few pixels from the item item and not exactly where the mouse is. |
|
@yotamberk Regarding the current way versus the previous way, I'd say that the supplied example doesn't do it justice. If the timeline chart was much larger, then I'm certain the current way would look far better (or, more accurately, the previous way would look far worse). As for following the mouse, I can totally do that. The reason I went with it saying at it's initial location is because that is how Google Chart's Timeline does it. It might be beneficial to add it as an option to Timeline, something like |
|
Okay I can see what you mean. The current way is good for now. If you can add that option that would be great =) |
mojoaxel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice addition! I aspeacially like that you reused the Popup-component. Perfect! Thanks!
| {id: 3, content: 'Item 3', start: '2016-01-03', type: 'point', | ||
| title: '<span style="color: red">Red</span> text'}, | ||
| {id: 4, content: 'Item 4', start: '2016-01-03', end: '2016-01-04', | ||
| title: '<table border="1"><tr><td>Cell 1</td><td>Cell 2</td></tr></table>'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could add also an example for "HTML element".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mojoaxel Do you mean adding an example that uses http://visjs.org/examples/timeline/items/htmlContents.html aswell as a HTML tool-tip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think he means a seperate example with an html tooltip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yotamberk I'm sorry, I don't seem to understand... These examples have HTML tool-tips (except for the first one, as it shows you don't need to use HTML)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True... maybe change the content of an item to html element and then i think the example is complete
|
@yotamberk I've changed the content of an item to use HTML in the example. However this brought to light a bug. Moving your mouse around over the HTML item moves the tool-tip weirdly. This is because the 'mouseout' and 'mouseover' events are called on children elements of the item. I personally see this as a bug with Timelines as a whole, not just HTML tool-tips. I would be happy to fix it in this pull request, but I think it might be better to have it as a separate GitHub issue & PR (assuming it is a bug with Timeline and not just HTML tool-tips) |
|
@lewisjb Okay I think it can be merged and have the other features and issues we talked about above in later issues (It would be great if you could open these issues).
? |
|
@yotamberk Thanks! Will do! As for why it's a bug with Timelines as a whole, not just HTML tool-tips: <div class='vis-item'>
<h1>HTML</h1>
Text
</div>So when you hovered over the |
Adding #338
Tested on Chrome version 55.0 and Internet Explorer version 11.576
This change will allow developers to specify a HTML 'title' (hover tool-tip) for timeline chart items.
Tried to keep code changes to a minimum, and implement it similarly to how Network does it.
The only possible issue with this that I can think of is changing the class of the tool-tip from 'vis-network-tooltip' to 'vis-tooltip' (if people were styling their network tooltip).