Skip to content

Instantly share code, notes, and snippets.

@yorzi
Created June 27, 2013 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorzi/5877185 to your computer and use it in GitHub Desktop.
Save yorzi/5877185 to your computer and use it in GitHub Desktop.
add simple tooltips for a line that's based on d3
svg.selectAll('.views_dot')
.data(data)
.enter()
.append('circle')
.attr("transform", "translate(10, 0)")
.attr('class', 'views_dot')
.attr('fill-opacity', 0)
.attr('cx', (d)->
x( new Date(d.date) )
)
.attr('cy', (d)-> y(d.value))
.attr('fill', 'orange')
.attr('r', 5)
.attr('data-toggle', 'popover')
.attr('data-content', (d)=>"#{d.date}: #{@formatValue()(d.value)}")
# tooptip for d3 line chart
$('.views_dot').popover
title: ''
container : 'body'
html : true
trigger : 'hover'
placement : 'top'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment