<% if @tracked_objects.any? %>
  <%
    chart_data = @tracked_objects.filter_map do |scan|
      if scan.duration_since_last_scan.present?
        {
          x: scan.num_added,
          y: scan.duration_since_last_scan.in_days.round(2),
          scanDate: scan.log_entry.requested_at.strftime("%Y-%m-%d %H:%M"),
          durationFormatted: format_duration_since_last_scan(scan.duration_since_last_scan)
        }
      end
    end
  %>
  <%= react_component(
    "TrackedObjectsChart",
    {
      prerender: false,
      props: {
        data: chart_data,
        objectKind: add_tracked_object_kind_for_view(@kind)
      }
    }
  ) %>
<% end %>
