1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <h2><%= l(:label_statistics) %></h2>
-
- <div class="repository-graph">
- <canvas id="commits_per_month"></canvas>
- </div>
-
- <div class="repository-graph">
- <canvas id="commits_per_author"></canvas>
- </div>
-
-
- <%= javascript_tag do %>
- $(document).ready(function(){
- $.getJSON(<%= raw url_for(:controller => 'repositories',
- :action => 'graph', :id => @project,
- :repository_id => @repository.identifier_param,
- :graph => "commits_per_month").to_json %>, function(data){
-
- var chartData = {
- labels: data['labels'],
- datasets: [{
- label: <%= raw l(:label_revision_plural).to_json %>,
- backgroundColor: 'rgba(255, 99, 132, 0.7)',
- borderColor: 'rgb(255, 99, 132)',
- borderWidth: 1,
- data: data['commits']
- }, {
- label: <%= raw l(:label_change_plural).to_json %>,
- backgroundColor: 'rgba(54, 162, 235, 0.7)',
- borderColor: 'rgb(54, 162, 235)',
- data: data['changes']
- }]
- };
- new Chart(document.getElementById("commits_per_month").getContext("2d"), {
- type: 'bar',
- data: chartData,
- options: {
- elements: {
- rectangle: {borderWidth: 2}
- },
- responsive: true,
- legend: {position: 'right'},
- title: {
- display: true,
- text: <%= raw l(:label_commits_per_month).to_json %>
- }
- }
- });
- });
-
- $.getJSON(<%= raw url_for(:controller => 'repositories',
- :action => 'graph', :id => @project,
- :repository_id => @repository.identifier_param,
- :graph => "commits_per_author").to_json %>, function(data){
-
- var chartData = {
- labels: data['labels'],
- datasets: [{
- label: <%= raw l(:label_revision_plural).to_json %>,
- backgroundColor: 'rgba(255, 99, 132, 0.7)',
- borderColor: 'rgb(255, 99, 132)',
- borderWidth: 1,
- data: data['commits']
- }, {
- label: <%= raw l(:label_change_plural).to_json %>,
- backgroundColor: 'rgba(54, 162, 235, 0.7)',
- borderColor: 'rgb(54, 162, 235)',
- data: data['changes']
- }]
- };
-
- new Chart(document.getElementById("commits_per_author").getContext("2d"), {
- type: 'horizontalBar',
- data: chartData,
- options: {
- elements: {
- rectangle: {borderWidth: 2}
- },
- responsive: true,
- legend: {position: 'right'},
- title: {
- display: true,
- text: <%= raw l(:label_commits_per_author).to_json %>
- }
- }
- });
- });
- });
- <% end %>
-
-
- <p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
-
- <% html_title(l(:label_repository), l(:label_statistics)) -%>
-
- <% content_for :header_tags do %>
- <%= javascript_include_tag "Chart.bundle.min" %>
- <% end %>
|