Skip to content

Business intelligence made simple

Fixed target line

Andrew Kane6d1f54a37f01
diff --git a/app/views/blazer/queries/run.html.erb b/app/views/blazer/queries/run.html.erb
index f64f864b..2993d5b8 100644
--- a/app/views/blazer/queries/run.html.erb
+++ b/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>