summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/graphs/graphs_show.js
blob: 36bad6db3e1dc99ce30eead722e0d9987b8b48ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import ContributorsStatGraph from './stat_graph_contributors';

document.addEventListener('DOMContentLoaded', () => {
  $.ajax({
    type: 'GET',
    url: document.querySelector('.js-graphs-show').dataset.projectGraphPath,
    dataType: 'json',
    success(data) {
      const graph = new ContributorsStatGraph();
      graph.init(data);

      $('#brush_change').change(() => {
        graph.change_date_header();
        graph.redraw_authors();
      });

      $('.stat-graph').fadeIn();
      $('.loading-graph').hide();
    },
  });
});