#1153: Convert rest of the stats to use ChartJS

This commit is contained in:
Jyri-Petteri Paloposki 2019-05-19 13:04:33 +03:00
parent dec82fd26c
commit f873a93eb3
5 changed files with 206 additions and 255 deletions

View file

@ -12,36 +12,35 @@ options = {
}
}
%>
<p><%= t('stats.actions_actions_avg_created_30days', :count => (actions.created_last30days*10.0/30.0).round/10.0 )%>
<%= t('stats.actions_avg_completed_30days', :count => (actions.done_last30days*10.0/30.0).round/10.0 )%>
<%= t('stats.actions_avg_created', :count => (actions.created_last12months*10.0/12.0).round/10.0 )%>
<%= t('stats.actions_avg_completed', :count => (actions.done_last12months*10.0/12.0).round/10.0 )%></p>
<% actions.completion_charts.each do |chart| %><%=
render :partial => 'chart', :locals => {:chart => chart}
-%><% end %>
<%= bar_chart actions.done_last30days_data, options.merge({'title': {'display': true, 'text': 'Actions in the last 30 days'}}) %>
<%= bar_chart actions.done_last12months_data, options.merge({'title': {'display': true, 'text': 'Actions in the last 12 months'}}) %>
<%= bar_chart actions.completion_time_data, options.merge({'title': {'display': true, 'text': 'Completion time (all completed actions)'}}) %>
<br style="clear:both">
<% actions.timing_charts.each do |chart| %><%=
render :partial => 'chart', :locals => {:chart => chart}
-%><% end %>
<%
Rails.logger.info actions.running_time_data
# TODO: There should be separate scales for percentage and amount of tasks so that the max of both is in the top of the chart.
%>
<%= bar_chart actions.visible_running_time_data, options.merge({'title': {'display': true, 'text': 'Current running time of incomplete visible actions'}}) %>
<%= bar_chart actions.running_time_data, library: { :series => { 0 => {type: "line"} } }, title: "Current running time of all incomplete actions" %>
<%= bar_chart actions.running_time_data, options.merge({'title': {'display': true, 'text': 'Current running time of all incomplete actions'}}) %>
<br style="clear:both">
<%= bar_chart actions.open_per_week_data, options.merge({scales: {yAxes: [{ scaleLabel: { display: true, labelString: 'Weeks ago'}}]}, 'title': {'display': true, 'text': 'Active (visible and hidden) next actions per week'}}) %>
<%= bar_chart actions.day_of_week_all_data, options.merge({'title': {'display': true, 'text': 'Day of week (all actions)'}}) %>
<%= bar_chart actions.day_of_week_30days_data, options.merge({'title': {'display': true, 'text': 'Day of week (past 30 days)'}}) %>
<br style="clear:both">
<%= bar_chart actions.time_of_day_all_data, options.merge({'title': {'display': true, 'text': 'Time of day (all actions)'}}) %>
<%= bar_chart actions.time_of_day_30days_data, options.merge({'title': {'display': true, 'text': 'Time of day (last 30 days)'}}) %>

View file

@ -37,6 +37,8 @@ Stats::TopContextsQuery.new(current_user, :running => true).result.map { |contex
%>
<%= pie_chart data, options.merge({'title': {'display': true, 'text': 'Spread of actions for visible contexts'}}) %>
<br style="clear:both">
<%= render :partial => 'contexts_list', :locals => {:contexts => contexts.actions, :key => 'contexts'} -%>
<%= render :partial => 'contexts_list', :locals => {:contexts => contexts.running_actions, :key => 'visible_contexts_with_incomplete_actions'} -%>