mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-06 12:50:19 +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
|
|
@ -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