Skip to content

Instantly share code, notes, and snippets.

@Veejay
Created May 4, 2012 01:02
Show Gist options
  • Save Veejay/2590837 to your computer and use it in GitHub Desktop.
Save Veejay/2590837 to your computer and use it in GitHub Desktop.
render: (date_range, models) ->
# Grab data
data = _.sortBy (get_data date_range, models), (o) ->
parseInt o.id.split("-").join(""), 10
# Scale
ratio = get_ratio @maxHeight, data
height = _.bind get_height, null, ratio
# Render
chart = d3.select(@el[0])
list = chart.selectAll("li")
.data(data, (d) -> d.id)
list
.style("height", height)
.attr("class", get_class)
.select("span")
.text(get_value)
list.enter().append("li")
.attr("class", get_class)
.style("height", height)
.append("span")
.text(get_value)
list.exit()
.remove()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment