     data.addColumn('number', 'month')
     data.addColumn('number', 'kW')
  
-    if $("#output_pa").attr('data-datapoints') != NaN
-      dni_string = $("#output_pa").data("datapoints")
+    if graph_div.attr('data-datapoints') != NaN
+      dni_string = graph_div.data("datapoints")
       dni_array = dni_string.split(" ").map(parseFloat)
       for month in [1..12]
         #if you change times here, remember to also change them in panel.dni_received_pa

      cameraPosition: {"horizontal": 5.6, "vertical": 0.2, "distance": 1.8}

    # Instantiate our graph object.
    graph = new links.Graph3d(document.getElementById('output_pa'))

    # Draw our graph with the created data and options
    graph.draw(data, options)

  drawVisualization() #>>>

  $('#index_link').click ->
    location.reload(true)

  data = null
  graph = null
  google.load("visualization", "1")
  graph_div = $("#output_pa")

  drawVisualization = () ->
    data = new google.visualization.DataTable
