morris.js/lib/morris.hover.coffee

23 lines
499 B
CoffeeScript
Raw Normal View History

2012-12-04 20:12:34 +01:00
class Morris.Hover
# Displays contextual information in a floating HTML div.
#
constructor: (options = {}) ->
@options = $.extend {}, Morris.Hover.defaults, options
@el = $ "<div class='#{@options.class}'></div>"
@el.hide()
@defaults:
class: 'morris-popup'
allowOverflow: false
2012-12-04 20:12:34 +01:00
show: (x, y, data) ->
if typeof @options.content is 'function'
@el.html @options.content(data)
else
@el.html @options.content
@el.show()
2012-12-04 20:12:34 +01:00
hide: ->
@el.hide()