           "q#{i}-#{categoryValues.length}"
         )
     else
-      maxValue = deduceMaxValue(data, valueProperty, allMappingPropertiesOnMap, mappingPropertyOnData)
-      minValue = deduceMinValue(data, valueProperty, allMappingPropertiesOnMap, mappingPropertyOnData)
+      maxValue = deduceMaxValue(scope.data, scope.valueProperty, allMappingPropertiesOnMap, scope.mappingPropertyOnData)
+      minValue = deduceMinValue(scope.data, scope.valueProperty, allMappingPropertiesOnMap, scope.mappingPropertyOnData)
       valFn = d3.scale.quantize()
         .domain([minValue, maxValue])
         .range(d3.range(quantizeSteps).map (i) ->

    mapPaths.exit().remove()


  renderMap = (scope, map, path) ->
    mapPaths = scope.mapGroup.selectAll('path')
      .data(map.features)
    mapPaths.enter().append('path')
      .attr('d', path)


  #    #############################################

  renderVisualization = (scope) ->
    path = deducePathProjection(scope.projection)
    renderMap(scope, path)


    map = scope.map
    data = scope.data
    valueProperty = scope.valueProperty
    mappingPropertyOnMap = scope.mappingPropertyOnMap
    mappingPropertyOnData = scope.mappingPropertyOnData


    bounds =  path.bounds(scope.map)
    resizeMap(scope.svg, bounds)

    if data
      quantizeSteps = scope.quantizeSteps || defaults.quantizeSteps
      allMappingPropertiesOnMap = deduceAllAvailableMappingOnMap(scope.map, scope.mappingPropertyOnMap)
      valFn = deduceValueFunction(scope, quantizeSteps, allMappingPropertiesOnMap)
      renderData(scope, valFn)
      renderLegend(scope, valFn)


