 x               = d3.scale.linear().domain([0, xMax]).range([0, maxBarWidth])
 xBarLabel       = (d) -> x d.points
 
-toggle = (ytd) ->
-  resource = if ytd then "rankings_ytd" else "rankings"
-  loadData resource, (rankings) -> showChart rankings
-
 initChart = ->
   # svg container element
   chart = d3.select("#rankings-chart")

    .attr('id', 'barsContainer')
    .attr("transform", "translate(" + barLabelWidth + "," + (gridLabelHeight + gridChartOffset) + ")")

showChart = (rankings) ->
  #updateGenerationTime rankings.generated_at
  data = rankings.data

  labels = d3.select("#labelsContainer").selectAll("text").data(data, (d) -> d.first + d.last)

  # Update transitions

T.def 'rankings', (ytd) ->
  [
    [ 'h2'
      'ATP rankings chart for top 50 players'
      [ 'span.generated-note'
        ' (generated at '
        [ 'span.generated-at' ]
        ' )'
      ]
    ]
    [ 'form#rankings-form'
      action: "#/rankings"
