     for item, count of topitems
       items[item][timestamp] = count
 
-  chart = prepareChart()
   # Limit timeframe to last half.
   if timeframe != 'overall'
     timestamps = timestamps[-timestamps.length // 2 .. -1]
 
+  chart = prepareChart(numberOfPositions)
   for item, weeks of items
     series =
       name: item

  return s


prepareChart = ->
  $chart = $('#chart')
  $chart.highcharts 'StockChart',
    chart:

               #{ Highcharts.dateFormat('%A, %b %e, %Y', @x) }
             </span>"
        points = _.sortBy(@points, (point) -> point.y)
        for point, index in points[-numberOfPositions..]
          strIndex = zfill(numberOfPositions - index, 2)
          if point.y > 0
            s += "<br/>#{ strIndex }
                  <span style=\"color: #{ point.series.color };\"> ● </span>"
