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'
|
2012-11-18 20:02:46 +01:00
|
|
|
allowOverflow: false
|
2012-12-02 23:23:59 +01:00
|
|
|
|
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-02 23:23:59 +01:00
|
|
|
|
2012-12-04 20:12:34 +01:00
|
|
|
hide: ->
|
|
|
|
@el.hide()
|
2012-12-02 23:23:59 +01:00
|
|
|
|