Browse Source

Fixed target line

Andrew Kane 9 năm trước cách đây
mục cha
commit
6d1f54a37f
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      app/views/blazer/queries/run.html.erb

+ 3 - 2
app/views/blazer/queries/run.html.erb

@@ -29,8 +29,9 @@
     <% column_types = blazer_column_types(@columns, @rows, @boom) %>
     <% chart_options = {id: chart_id, min: nil} %>
     <% series_library = {} %>
-    <% @columns.select { |k| k.downcase == "target" }.each_with_index do |key, i| %>
-      <% series_library[i] = {pointStyle: "line", hitRadius: 5, borderColor: "#109618", pointBackgroundColor: "#109618", backgroundColor: "#109618"} %>
+    <% target_index = @columns.index { |k| k.downcase == "target" } %>
+    <% if target_index %>
+      <% series_library[target_index - 1] = {pointStyle: "line", hitRadius: 5, borderColor: "#109618", pointBackgroundColor: "#109618", backgroundColor: "#109618"} %>
     <% end %>
     <% if blazer_maps? && @markers.any? %>
       <div id="map" style="height: <%= @only_chart ? 300 : 500 %>px;"></div>