Browse Source

Chart null columns

Andrew Kane 8 years ago
parent
commit
f125c33b5c
2 changed files with 3 additions and 1 deletions
  1. 2 0
      app/helpers/blazer/base_helper.rb
  2. 1 1
      app/views/blazer/queries/run.html.erb

+ 2 - 0
app/helpers/blazer/base_helper.rb

@@ -25,6 +25,8 @@ module Blazer
           "numeric"
         elsif v.is_a?(Time) || v.is_a?(Date)
           "time"
+        elsif v.nil?
+          nil
         else
           "string"
         end

+ 1 - 1
app/views/blazer/queries/run.html.erb

@@ -60,7 +60,7 @@
         featureLayer.setGeoJSON(geojson);
         map.fitBounds(featureLayer.getBounds());
       </script>
-    <% elsif values.size >= 2 && column_types == ["time"] + (values.size - 1).times.map { "numeric" } %>
+    <% elsif values.size >= 2 && column_types.compact == ["time"] + (column_types.compact.size - 1).times.map { "numeric" } %>
       <% time_k = @columns.keys.first %>
       <%= line_chart @columns.keys[1..-1].map{|k| {name: k, data: @rows.map{|r| [r[time_k], r[k]] }} }, chart_options %>
     <% elsif values.size == 3 && column_types == ["time", "string", "numeric"] %>