Sha256: 9d3e1b81cc123258cb9189fbd8fa0a4cfb36c50a097fb1d5e774cd6b192bf9a7

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

root = exports ? window
root.Swagr = if root.Swagr then root.Swagr else {}

# Assumes d3graph.coffee has been required before this one...
class root.Swagr.UpdatingToplist extends root.Swagr.D3Graph
  _transform_string: -> "translate(0,20)"

  _enter_new_elements: (text) ->
    @elems.enter().append("text")
        .attr("class", "enter")
        .attr("dx", ".35em")
        .attr("x", @opts.transition_x)
        .attr("y", @ymapper(@elems, @data))
        .style("fill-opacity", 1e-6)
        .text(@textmapper(@elems, @data))
        .transition()
        .duration(@opts.transition_time)
        .attr("x", 0)
        .style("fill-opacity", 1)

  _update_existing_elements: (text) ->
    @elems.attr("class", "update")
        .text(@textmapper(@elems, @data))
        .transition()
        .duration(@opts.transition_time)
        .attr("y", @ymapper(@elems, @data))

  _remove_exiting_elements: (text) ->
    @elems.exit()
        .attr("class", "exit")
        .transition()
        .duration(@opts.transition_time)
        .attr("y", (d, i) => @opts.height)
        .style("fill-opacity", 1e-6)
        .remove()

  ymapper: (elems, data) -> (d,i) -> i * 25

  textmapper: (elems, data) -> (d,i) -> d

Version data entries

4 entries across 2 versions & 1 rubygems

Version Path
swagr-0.0.6 examples/examples01/coffee/updating_top_list.coffee
swagr-0.0.6 templates/coffee/updating_top_list.coffee
swagr-0.0.5 examples/examples01/coffee/updating_top_list.coffee
swagr-0.0.5 templates/coffee/updating_top_list.coffee