mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-08 08:34:21 +01:00
#1153: Use translations properly, add missing labels, fix bugs and add links to charts
This commit is contained in:
parent
0a106aac5e
commit
0b326e17d8
4 changed files with 160 additions and 75 deletions
|
|
@ -7,9 +7,9 @@ options = {
|
|||
responsive: false,
|
||||
plugins: {
|
||||
colorschemes: {
|
||||
scheme: 'brewer.Paired12'
|
||||
}
|
||||
}
|
||||
scheme: 'brewer.Paired12',
|
||||
},
|
||||
},
|
||||
}
|
||||
%>
|
||||
<p><%= t('stats.actions_actions_avg_created_30days', :count => (actions.created_last30days*10.0/30.0).round/10.0 )%>
|
||||
|
|
@ -17,31 +17,98 @@ options = {
|
|||
<%= 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>
|
||||
|
||||
<%= bar_chart actions.done_last30days_data, options.merge({'title': {'display': true, 'text': 'Actions in the last 30 days'}}) %>
|
||||
<%= bar_chart actions.done_last30days_data, options.merge({
|
||||
scales: {
|
||||
xAxes: [{ scaleLabel: { display: true, labelString: t('stats.legend.number_of_days')}}],
|
||||
yAxes: [{ scaleLabel: { display: true, labelString: t('stats.legend.number_of_actions')}}],
|
||||
},
|
||||
'title': {'display': true, 'text': t('stats.actions_30days_title')},
|
||||
}) %>
|
||||
|
||||
<%= bar_chart actions.done_last12months_data, options.merge({'title': {'display': true, 'text': 'Actions in the last 12 months'}}) %>
|
||||
<%
|
||||
# TODO: Missing the first 3 month avg values because they're null?
|
||||
%>
|
||||
<%= bar_chart actions.done_last12months_data, options.merge({
|
||||
scales: {
|
||||
xAxes: [{ scaleLabel: { display: true, labelString: t('stats.legend.months_ago')}}],
|
||||
yAxes: [{ scaleLabel: { display: true, labelString: t('stats.legend.number_of_actions')}}],
|
||||
},
|
||||
'title': {'display': true, 'text': t('stats.actions_lastyear_title')},
|
||||
'onClick': 'function() { window.location.href = "' + url_for(:controller => 'stats', :action => 'actions_done_last_years') + '"; }',
|
||||
}) %>
|
||||
|
||||
<%= bar_chart actions.completion_time_data, options.merge({'title': {'display': true, 'text': 'Completion time (all completed actions)'}}) %>
|
||||
<%
|
||||
# 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, ie. the left y-axis should be "Percentage".
|
||||
%>
|
||||
<%= bar_chart actions.completion_time_data, options.merge({
|
||||
scales: {
|
||||
xAxes: [{ scaleLabel: { display: true, labelString: t('stats.legend.running_time')}}],
|
||||
yAxes: [{ scaleLabel: { display: true, labelString: t('stats.legend.actions')}}],
|
||||
},
|
||||
'title': {'display': true, 'text': t('stats.action_completion_time_title')}}) %>
|
||||
|
||||
<br style="clear:both">
|
||||
|
||||
<%
|
||||
# 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.
|
||||
# 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, ie. the left y-axis should be "Percentage".
|
||||
%>
|
||||
<%= bar_chart actions.visible_running_time_data, options.merge({'title': {'display': true, 'text': 'Current running time of incomplete visible actions'}}) %>
|
||||
<%= bar_chart actions.visible_running_time_data, options.merge({
|
||||
scales: {
|
||||
xAxes: [{ scaleLabel: { display: true, labelString: t('stats.running_time_legend.weeks')}}],
|
||||
yAxes: [{ scaleLabel: { display: true, labelString: t('stats.running_time_legend.actions')}}],
|
||||
},
|
||||
'title': {'display': true, 'text': t('stats.current_running_time_of_incomplete_visible_actions')},
|
||||
'onClick': 'function(event, array) { window.location.href = "' + url_for(:controller => 'stats', :action => 'show_selected_actions_from_chart', :id => "art") + '?index=" + array[0]._index; }',
|
||||
}) %>
|
||||
|
||||
<%= 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)'}}) %>
|
||||
<%
|
||||
# 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, ie. the left y-axis should be "Percentage".
|
||||
%>
|
||||
<%= bar_chart actions.running_time_data, options.merge({
|
||||
scales: {
|
||||
xAxes: [{ scaleLabel: { display: true, labelString: t('stats.running_time_all_legend.running_time')}}],
|
||||
yAxes: [{ scaleLabel: { display: true, labelString: t('stats.running_time_legend.actions')}}],
|
||||
},
|
||||
'title': {'display': true, 'text': t('stats.running_time_all')},
|
||||
'onClick': 'function(event, array) { window.location.href = "' + url_for(:controller => 'stats', :action => 'show_selected_actions_from_chart', :id => "avrt") + '?index=" + array[0]._index; }',
|
||||
}) %>
|
||||
|
||||
<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.open_per_week_data, options.merge({
|
||||
scales: {
|
||||
xAxes: [{ scaleLabel: { display: true, labelString: t('stats.open_per_week_legend.weeks')}}],
|
||||
yAxes: [{ scaleLabel: { display: true, labelString: t('stats.open_per_week_legend.actions')}}],
|
||||
},
|
||||
'title': {'display': true, 'text': t('stats.open_per_week')}}) %>
|
||||
|
||||
<%= bar_chart actions.time_of_day_30days_data, options.merge({'title': {'display': true, 'text': 'Time of day (last 30 days)'}}) %>
|
||||
<%= bar_chart actions.day_of_week_all_data, options.merge({
|
||||
scales: {
|
||||
xAxes: [{ scaleLabel: { display: true, labelString: t('stats.actions_day_of_week_legend.day_of_week')}}],
|
||||
yAxes: [{ scaleLabel: { display: true, labelString: t('stats.actions_day_of_week_legend.number_of_actions')}}],
|
||||
},
|
||||
'title': {'display': true, 'text': t('stats.actions_day_of_week_title')}}) %>
|
||||
|
||||
<%= bar_chart actions.day_of_week_30days_data, options.merge({
|
||||
scales: {
|
||||
xAxes: [{ scaleLabel: { display: true, labelString: t('stats.actions_dow_30days_legend.day_of_week')}}],
|
||||
yAxes: [{ scaleLabel: { display: true, labelString: t('stats.actions_dow_30days_legend.number_of_actions')}}],
|
||||
},
|
||||
'title': {'display': true, 'text': t('stats.actions_dow_30days_title')}}) %>
|
||||
|
||||
<br style="clear:both">
|
||||
|
||||
<%= bar_chart actions.time_of_day_all_data, options.merge({
|
||||
scales: {
|
||||
xAxes: [{ scaleLabel: { display: true, labelString: t('stats.time_of_day_legend.time_of_day')}}],
|
||||
yAxes: [{ scaleLabel: { display: true, labelString: t('stats.time_of_day_legend.number_of_actions')}}],
|
||||
},
|
||||
'title': {'display': true, 'text': t('stats.time_of_day')}}) %>
|
||||
|
||||
<%= bar_chart actions.time_of_day_30days_data, options.merge({
|
||||
scales: {
|
||||
xAxes: [{ scaleLabel: { display: true, labelString: t('stats.tod30_legend.time_of_day')}}],
|
||||
yAxes: [{ scaleLabel: { display: true, labelString: t('stats.tod30_legend.number_of_actions')}}],
|
||||
},
|
||||
'title': {'display': true, 'text': t('stats.tod30')}}) %>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
<% data = {
|
||||
datasets: [{
|
||||
data: Array.new
|
||||
data: Array.new,
|
||||
}],
|
||||
labels: Array.new
|
||||
labels: Array.new,
|
||||
ids: Array.new,
|
||||
}
|
||||
Stats::TopContextsQuery.new(current_user).result.map { |context|
|
||||
data[:datasets][0][:data].append(context.total)
|
||||
data[:labels].append(context.name)
|
||||
data[:ids].append(context.id)
|
||||
}
|
||||
options = {
|
||||
width: "400px",
|
||||
|
|
@ -17,25 +19,33 @@ options = {
|
|||
responsive: false,
|
||||
plugins: {
|
||||
colorschemes: {
|
||||
scheme: 'brewer.Paired12'
|
||||
}
|
||||
}
|
||||
scheme: 'brewer.Paired12',
|
||||
},
|
||||
},
|
||||
}
|
||||
%>
|
||||
<%= pie_chart data, options.merge({'title': {'display': true, 'text': 'Spread of actions for all contexts'}}) %>
|
||||
<% #TODO: Move data handling to model. Show value as percentage %>
|
||||
<%= pie_chart data, options.merge({
|
||||
'title': {'display': true, 'text': t('stats.spread_of_actions_for_all_context')},
|
||||
'onClick': 'function(event, array) { console.log(array); window.location.href = "' + url_for(:controller => 'contexts', :action => 'show', :id => -1).gsub('-1', '') + '" + array[0]._chart.chart.data.ids[array[0]._index]; }'
|
||||
}) %>
|
||||
|
||||
<% data = {
|
||||
datasets: [{
|
||||
data: Array.new
|
||||
data: Array.new,
|
||||
}],
|
||||
labels: Array.new
|
||||
}
|
||||
labels: Array.new,
|
||||
ids: Array.new,
|
||||
}
|
||||
Stats::TopContextsQuery.new(current_user, :running => true).result.map { |context|
|
||||
data[:datasets][0][:data].append(context.total)
|
||||
data[:labels].append(context.name)
|
||||
data[:ids].append(context.id)
|
||||
}
|
||||
%>
|
||||
<%= pie_chart data, options.merge({'title': {'display': true, 'text': 'Spread of actions for visible contexts'}}) %>
|
||||
<%= pie_chart data, options.merge({
|
||||
'onClick': 'function(event, array) { console.log(array); window.location.href = "' + url_for(:controller => 'contexts', :action => 'show', :id => -1).gsub('-1', '') + '" + array[0]._chart.chart.data.ids[array[0]._index]; }',
|
||||
'title': {'display': true, 'text': t('stats.spread_of_running_actions_for_visible_contexts')}}) %>
|
||||
|
||||
<br style="clear:both">
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue