       cameraPosition: {"horizontal": 5.6, "vertical": 0.2, "distance": 1.8}
 
     # Instantiate our graph object.
+    #cannot use graph_div variable here
     graph = new links.Graph3d(document.getElementById('output_pa'))
 
     # Draw our graph with the created data and options
     graph.draw(data, options)
 
-  drawVisualization() #>>>
+  #do not create graph if there is no irradiance data
+  if graph_div.data('datapoints').length > 0
+    drawVisualization()
+  else
+    alert ('oops')
+    graph_div.children().append(' There was no solar data for your postcode.')
+  #>>>
 
   $('#index_link').click ->
     location.reload(true)

    data.addColumn('number', 'month')
    data.addColumn('number', 'kW')
 
    if $("#output_pa").attr('data-datapoints') != NaN
      dni_string = $("#output_pa").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

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

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