       domain: [0,15,30]
     kda:
       range: ["#7A1810","#3B3E40","#0F7015"]
-      domain: [1,1.5,3]
+      domain: [1,2,3]
 
   getInitialState: ->
     if @props and @props.data
       return _.extend @DEFAULT, @props
     else
-      @get_data()
+      @_get_data()
       return @DEFAULT
 
   componentDidMount: ->

          children: response
    )


  componentDidUpdate: ->
    @treemap = d3.layout.treemap()
        .round(false)
        .size([960, 500])
        .sticky(true)
        .value((d) =>
          return d[@state.size] + 5000
        )

    @color = d3.scale.linear()
      .range(@SCALES[@state.color].range)
      .domain(@SCALES[@state.color].domain)
    console.log(@state.data)
    nodes = @treemap.nodes(@state.data)
    chart = d3.select(".treemap-points")
    cells = chart.selectAll("g.cell.parent").data(nodes)
                 .enter()
                 .append("svg:g")
                 .attr("class", "cell")
                 .attr("transform", (d) ->
                   return "translate(" + d.x + "," + d.y + ")"
                 )

    cells.append("svg:rect")
      .attr("class", "cell-box")

  componentWillUnmount: ->
    @_unsubscribeFromEvents()


  # Don't update the component if we are just changing region or day
  # because the ajax call hasnt finished yet
  shouldComponentUpdate: (props, state) ->
    return false if state.region isnt @state.region
    return false if state.day    isnt @state.day
    return true

  componentDidUpdate: ->
    if @treemap
      @_update_graph()
    else
      @_build_graph()


  _subscribeToEvents: ->
    # When the reset button is clicked...
    PubSub.subscribe 'dropdown.regions', (msg, data) =>
      @setState
        region: data.value
      @_get_data()

    PubSub.subscribe 'dropdown.days', (msg, data) =>
      @setState
        day: data.value
      @_get_data()

    PubSub.subscribe 'dropdown.pivots', (msg, data) =>
      @setState
        color: data.value

  _unsubscribeFromEvents: ->
    PubSub.unsubscribe 'dropdown'


  _get_data: ->
    url = @URL
    if @state?.region?  || @state?.day?
      params = {region: @state.region, day: @state.day}
