Add a chart showing all events in admin stats
Not sure it's useful, but it makes the main admin stats page a bit more interesting.
This commit is contained in:
19
app/components/admin/stats/global_chart_component.rb
Normal file
19
app/components/admin/stats/global_chart_component.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class Admin::Stats::GlobalChartComponent < ApplicationComponent
|
||||
private
|
||||
|
||||
def event_names
|
||||
Ahoy::Chart.active_event_names
|
||||
end
|
||||
|
||||
def chart_tag
|
||||
tag.div("data-graph": data_points.to_json)
|
||||
end
|
||||
|
||||
def data_points
|
||||
Ahoy::Chart.active_events_data_points
|
||||
end
|
||||
|
||||
def title
|
||||
t("admin.stats.graph.title")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user