gitstats-rb 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/LICENSE +674 -0
  4. data/README.md +74 -0
  5. data/bin/gitstats +200 -0
  6. data/gitstats-rb.gemspec +24 -0
  7. data/lib/gitstats.rb +18 -0
  8. data/lib/gitstats/author.rb +37 -0
  9. data/lib/gitstats/git.rb +165 -0
  10. data/lib/gitstats/renderer.rb +30 -0
  11. data/lib/gitstats/renderer/gnuplot.rb +150 -0
  12. data/lib/gitstats/renderer/haml.rb +72 -0
  13. data/lib/gitstats/renderer/sass.rb +33 -0
  14. data/lib/gitstats/statgen.rb +119 -0
  15. data/lib/gitstats/stats.rb +12 -0
  16. data/lib/gitstats/stats/commit.rb +63 -0
  17. data/lib/gitstats/stats/commit/author.rb +17 -0
  18. data/lib/gitstats/stats/commit/time.rb +109 -0
  19. data/lib/gitstats/stats/file.rb +15 -0
  20. data/lib/gitstats/stats/file/filetype.rb +14 -0
  21. data/lib/gitstats/yearmonth.rb +39 -0
  22. data/template/gnuplot/activity.haml +3 -0
  23. data/template/gnuplot/asc.gif +0 -0
  24. data/template/gnuplot/authors.haml +2 -0
  25. data/template/gnuplot/bg.gif +0 -0
  26. data/template/gnuplot/commits_per_hour.plot +14 -0
  27. data/template/gnuplot/commits_per_month.plot +15 -0
  28. data/template/gnuplot/commits_per_wday.plot +15 -0
  29. data/template/gnuplot/commits_per_year.plot +11 -0
  30. data/template/gnuplot/commits_per_yearmonth.plot +11 -0
  31. data/template/gnuplot/desc.gif +0 -0
  32. data/template/gnuplot/filechanges_by_yearmonth.plot +17 -0
  33. data/template/gnuplot/files.haml +2 -0
  34. data/template/gnuplot/files_by_yearmonth.plot +11 -0
  35. data/template/gnuplot/helpers/block.rb +26 -0
  36. data/template/gnuplot/helpers/config.rb +12 -0
  37. data/template/gnuplot/helpers/names.rb +79 -0
  38. data/template/gnuplot/helpers/utils.rb +16 -0
  39. data/template/gnuplot/index.haml +2 -0
  40. data/template/gnuplot/jqplot.canvasAxisLabelRenderer.min.js +57 -0
  41. data/template/gnuplot/jqplot.canvasAxisTickRenderer.min.js +57 -0
  42. data/template/gnuplot/jqplot.canvasTextRenderer.min.js +57 -0
  43. data/template/gnuplot/jqplot.cursor.min.js +57 -0
  44. data/template/gnuplot/jqplot.dateAxisRenderer.min.js +57 -0
  45. data/template/gnuplot/jquery.jqplot.min.css +1 -0
  46. data/template/gnuplot/jquery.jqplot.min.js +57 -0
  47. data/template/gnuplot/jquery.js +4 -0
  48. data/template/gnuplot/jquery.tablesorter.js +4 -0
  49. data/template/gnuplot/lastweeks.plot +14 -0
  50. data/template/gnuplot/layouts/default.haml +117 -0
  51. data/template/gnuplot/linechanges_by_yearmonth.plot +17 -0
  52. data/template/gnuplot/lines.haml +2 -0
  53. data/template/gnuplot/lines_by_yearmonth.plot +11 -0
  54. data/template/gnuplot/partials/authors.haml +30 -0
  55. data/template/gnuplot/partials/blockheader.haml +2 -0
  56. data/template/gnuplot/partials/blocktoc.haml +7 -0
  57. data/template/gnuplot/partials/commitchart.haml +60 -0
  58. data/template/gnuplot/partials/commits_per_month.haml +27 -0
  59. data/template/gnuplot/partials/commits_per_year.haml +27 -0
  60. data/template/gnuplot/partials/commits_per_yearmonth.haml +27 -0
  61. data/template/gnuplot/partials/day_of_week.haml +28 -0
  62. data/template/gnuplot/partials/filechanges_by_yearmonth.haml +3 -0
  63. data/template/gnuplot/partials/files_by_yearmonth.haml +3 -0
  64. data/template/gnuplot/partials/fileschart.haml +86 -0
  65. data/template/gnuplot/partials/filetypes.haml +23 -0
  66. data/template/gnuplot/partials/general.haml +34 -0
  67. data/template/gnuplot/partials/hour_of_day.haml +28 -0
  68. data/template/gnuplot/partials/hour_of_week.haml +24 -0
  69. data/template/gnuplot/partials/lastweeks.haml +24 -0
  70. data/template/gnuplot/partials/linechanges_by_yearmonth.haml +3 -0
  71. data/template/gnuplot/partials/lines_by_yearmonth.haml +3 -0
  72. data/template/gnuplot/partials/lineschart.haml +86 -0
  73. data/template/gnuplot/partials/repos.haml +13 -0
  74. data/template/gnuplot/partials/top_authors_of_year.haml +30 -0
  75. data/template/gnuplot/partials/top_authors_of_yearmonth.haml +30 -0
  76. data/template/gnuplot/style.scss +132 -0
  77. data/template/highcharts/activity.haml +5 -0
  78. data/template/highcharts/authors.haml +3 -0
  79. data/template/highcharts/bootstrap-theme.min.css +10 -0
  80. data/template/highcharts/bootstrap.min.css +10 -0
  81. data/template/highcharts/bootstrap.min.js +11 -0
  82. data/template/highcharts/exporting.js +23 -0
  83. data/template/highcharts/glyphicons-halflings-regular.eot +0 -0
  84. data/template/highcharts/glyphicons-halflings-regular.svg +229 -0
  85. data/template/highcharts/glyphicons-halflings-regular.ttf +0 -0
  86. data/template/highcharts/glyphicons-halflings-regular.woff +0 -0
  87. data/template/highcharts/heatmap.js +23 -0
  88. data/template/highcharts/helpers/block.rb +27 -0
  89. data/template/highcharts/helpers/names.rb +62 -0
  90. data/template/highcharts/helpers/params.rb +35 -0
  91. data/template/highcharts/highcharts.js +308 -0
  92. data/template/highcharts/index.haml +2 -0
  93. data/template/highcharts/jquery-1.11.1.min.js +4 -0
  94. data/template/highcharts/jquery.dataTables.min.css +1 -0
  95. data/template/highcharts/jquery.dataTables.min.js +164 -0
  96. data/template/highcharts/layouts/default.haml +54 -0
  97. data/template/highcharts/partials/activity_per_day.haml +65 -0
  98. data/template/highcharts/partials/activity_per_hour.haml +42 -0
  99. data/template/highcharts/partials/activity_per_month.haml +47 -0
  100. data/template/highcharts/partials/activity_per_week_last_year.haml +47 -0
  101. data/template/highcharts/partials/activity_per_weekday.haml +44 -0
  102. data/template/highcharts/partials/activity_per_weekday_and_hour.haml +20 -0
  103. data/template/highcharts/partials/blocktoc.haml +4 -0
  104. data/template/highcharts/partials/commits_per_author.haml +64 -0
  105. data/template/highcharts/partials/commits_per_author_detailed.haml +92 -0
  106. data/template/highcharts/partials/general.haml +33 -0
  107. data/template/highcharts/partials/globalstats.haml +41 -0
  108. data/template/highcharts/partials/repos.haml +12 -0
  109. data/template/highcharts/set_highcharts.js +323 -0
  110. data/template/highcharts/style.scss +148 -0
  111. metadata +227 -0
@@ -0,0 +1,20 @@
1
+ - data = []
2
+ - stats.wday_stats.each do |day,c|
3
+ - data.concat(c.map { |h,commit| [h,(day + 6) % 7,commit.commits] })
4
+ - block(:activity_per_weekday_and_hour) do
5
+ #chart_activity_per_weekday_and_hour{:style => "height: 500px"}
6
+
7
+ %script
8
+ var chart_activity_per_weekday_and_hour = new Object();
9
+ chart_activity_per_weekday_and_hour.label = '#{label(:activity_per_weekday_and_hour)}';
10
+ chart_activity_per_weekday_and_hour.target = '#chart_activity_per_weekday_and_hour';
11
+ chart_activity_per_weekday_and_hour.label_x = 'Hour';
12
+ chart_activity_per_weekday_and_hour.label_y = 'Day';
13
+ chart_activity_per_weekday_and_hour.categories_x = #{(0..23).map{ |v| v.to_s }};
14
+ chart_activity_per_weekday_and_hour.categories_y = #{(0..6).map{ |v| weekday(v) }};
15
+ chart_activity_per_weekday_and_hour.series_name = 'Commits';
16
+ chart_activity_per_weekday_and_hour.series_data = #{data};
17
+
18
+ $(document).ready(function() {
19
+ createHeatMap(chart_activity_per_weekday_and_hour);
20
+ });
@@ -0,0 +1,4 @@
1
+ %ul.nav.sidbar-nav
2
+ - blocks.each do |name|
3
+ %li
4
+ %a{:href => "#block-#{name.to_s}"}= label(name)
@@ -0,0 +1,64 @@
1
+ - graphData = stats.author_stats.map{ |name,c| [name.to_s, c.commits, c.lines_added, c.lines_deleted] }.sort{ |a, b| b[1] <=> a[1] }
2
+ - tableData = stats.author_stats.sort{ |a, b| a[1].commits <=> b[1].commits }.reverse
3
+
4
+ -# truncate the number of authors in the table
5
+ - truncatedTable = true if tableData.length > maxAuthorsInTable
6
+ - tableData = tableData[0..maxAuthorsInTable-1] if truncatedTable
7
+
8
+ -# truncate the number of authors in the graph
9
+ - truncatedGraph = true if graphData.length > maxAuthorsInGraph
10
+ - graphData = graphData[0..maxAuthorsInGraph-1] if truncatedGraph
11
+
12
+ - block(:commits_per_author,12) do
13
+ #chart_commits_per_author{:style => "height: 500px"}
14
+ - if truncatedGraph
15
+ .alert.alert-danger Too many authors. Data of the graph has been truncated!
16
+
17
+ %div.panel.panel-default
18
+ %div.panel-heading{"data-toggle" => "collapse", "data-target" => "#author_table_box"} Table
19
+ %div.panel-body.collapse#author_table_box
20
+ %table.table.table-striped.table-hover#author_table
21
+ %thead
22
+ %tr
23
+ %th Author
24
+ %th Commits
25
+ %th Percent
26
+ %th Files added
27
+ %th Files deleted
28
+ %th Lines added
29
+ %th Lines deleted
30
+ %th First commit
31
+ %th Last commit
32
+ %tbody
33
+ - tableData.each do |author, commits|
34
+ %tr
35
+ %td&= author
36
+ %td&= commits.commits
37
+ %td&= '%.2f%%' % (commits.commits * 100.0 / stats.num_commits.to_f)
38
+ %td&= commits.files_added
39
+ %td&= commits.files_deleted
40
+ %td&= commits.lines_added
41
+ %td&= commits.lines_deleted
42
+ %td&= commits.first_commit.strftime('%Y-%m-%d')
43
+ %td&= commits.last_commit.strftime('%Y-%m-%d')
44
+ - if truncatedGraph
45
+ .alert.alert-danger Too many authors. Data of the table has been truncated!
46
+
47
+ %script
48
+ var chart_commits_per_author = new Object();
49
+ chart_commits_per_author.label = '#{label(:commits_per_author)}';
50
+ chart_commits_per_author.label_y_axis = "Number of commits";
51
+ chart_commits_per_author.label_y2_axis = "Changed lines";
52
+ chart_commits_per_author.target = '#chart_commits_per_author';
53
+ chart_commits_per_author.categories = #{graphData.map{ |v| v[0] }};
54
+ chart_commits_per_author.series = [{"name":"Commits","yAxis": 0,"stack":"commits","data":#{graphData.map{ |v| v[1] }}},{"name":"Added lines","color": "#6CC644","stack":"changes","yAxis": 1,"data":#{graphData.map{ |v| v[2] }}},{"name":"Deleted lines","color": "#BD2C00","stack":"changes","yAxis": 1,"data":#{graphData.map{ |v| v[3] }}}];
55
+
56
+ $("#author_table_box").one('show.bs.collapse', function () {
57
+ $('#author_table').DataTable({
58
+ "order": [[ 1, "desc" ]]
59
+ });
60
+ });
61
+
62
+ $(document).ready(function() {
63
+ createColumnChart(chart_commits_per_author);
64
+ });
@@ -0,0 +1,92 @@
1
+ - authors = stats.author_stats.to_a.sort{ |a, b| b[1].commits <=> a[1].commits }
2
+ - fc = stats.general_stats.first_commit
3
+ - lc = stats.general_stats.last_commit
4
+
5
+ -# truncate the number of authors
6
+ - truncatedAuthors = true if authors.length > maxAuthorDetails
7
+ - authors = authors[0..maxAuthorDetails-1] if truncatedAuthors
8
+
9
+ - block(:commits_per_author_detailed,12) do
10
+ - authors.each_with_index do |v,i|
11
+ - daysTable = v[1].daystats.map{|d,s| [d, "Date.UTC(#{d.year},#{d.mon-1},#{d.mday})", s.commits, s.lines_added, s.lines_deleted, s.files_added, s.files_deleted]}.sort{|a,b| a[0] <=> b[0]}
12
+ - daysGraph = daysTable
13
+
14
+ -# truncate the number of days per authors in graph
15
+ - truncatedGraph = true if daysGraph.length > maxDaysPerAuthorInGraph
16
+ - daysGraph = daysGraph[-maxDaysPerAuthorInGraph..-1] if truncatedGraph
17
+
18
+ -# truncate the number of days per authors in table
19
+ - truncatedTable = true if daysTable.length > maxDaysPerAuthorInTable
20
+ - daysTable = daysTable[-maxDaysPerAuthorInTable..-1] if truncatedTable
21
+
22
+ - commits_str = "[#{daysGraph.map{|v| "[#{v[1]}, #{v[2]}]"}.join(", ")}]"
23
+ - added_lines_str = "[#{daysGraph.map{|v| "[#{v[1]}, #{v[3]}]"}.join(", ")}]"
24
+ - deleted_lines_str = "[#{daysGraph.map{|v| "[#{v[1]}, #{v[4]}]"}.join(", ")}]"
25
+
26
+ %div.thumbnail.col-md-6
27
+ %h4
28
+ #{v[0].name}
29
+ %br
30
+ %small= v[0].email
31
+ %h5= v[1].commits
32
+ %div.panel.panel-default
33
+ %div.panel-heading{"data-toggle" => "collapse", "data-target" => "#activity_per_author_#{i}"}= label(:activity_per_day)
34
+ %div.panel-body.col-md-12{:class => (i > expandedAuthors-1 ? "collapse" : "collapse in" ), :id => "activity_per_author_#{i}"}
35
+ %div{:id => "chart_commits_per_author_#{i}", :style => "height: 300px; width: 95%"}
36
+
37
+ - if truncatedGraph
38
+ .alert.alert-danger Too many active days. Data of the graph has been truncated!
39
+
40
+ %div.panel.panel-default
41
+ %div.panel-heading{"data-toggle" => "collapse", "data-target" => "#commits_per_author_#{i}_box"} Table
42
+ %div.panel-body.collapse{:id => "commits_per_author_#{i}_box"}
43
+ %table.table.table-striped.table-hover{:id => "commits_per_author_#{i}_table"}
44
+ %thead
45
+ %tr
46
+ %th Date
47
+ %th Commits
48
+ %th Files added
49
+ %th Files deleted
50
+ %th Lines added
51
+ %th Lines deleted
52
+ %tbody
53
+ - daysTable.each do |date, dateJs, commits, lines_added, lines_deleted, files_added, files_deleted|
54
+ %tr
55
+ %td&= date
56
+ %td&= commits
57
+ %td&= files_added
58
+ %td&= files_deleted
59
+ %td&= lines_added
60
+ %td&= lines_deleted
61
+ - if truncatedTable
62
+ .alert.alert-danger Too many active days. Data of the table has been truncated!
63
+
64
+ %script
65
+ var chart_commits_per_author_#{i} = new Object();
66
+ chart_commits_per_author_#{i}.x_min = Date.UTC(#{fc.year},#{fc.mon-1},#{fc.mday})
67
+ chart_commits_per_author_#{i}.x_max = Date.UTC(#{lc.year},#{lc.mon-1},#{lc.mday})
68
+ chart_commits_per_author_#{i}.label = '#{label(:commits_per_author_detailed)}';
69
+ chart_commits_per_author_#{i}.label_y_axis = "Number of commits";
70
+ chart_commits_per_author_#{i}.label_y2_axis = "Changed lines";
71
+ chart_commits_per_author_#{i}.target = '#chart_commits_per_author_#{i}';
72
+ chart_commits_per_author_#{i}.series = [{"name":"Commits","yAxis": 0,"data":#{commits_str}},{"name":"Added lines","color": "#6CC644","yAxis": 1,"data":#{added_lines_str}},{"name":"Deleted lines","color": "#BD2C00","yAxis": 1,"data":#{deleted_lines_str}}];
73
+ chart_commits_per_author_#{i}.legend = {};
74
+
75
+ $("#commits_per_author_#{i}_box").one('show.bs.collapse', function () {
76
+ $("#commits_per_author_#{i}_table").DataTable({
77
+ "order": [[ 0, "asc" ]]
78
+ });
79
+ });
80
+
81
+ - if i > expandedAuthors-1
82
+ $("#activity_per_author_#{i}").one('shown.bs.collapse', function () {
83
+ createDateAreaChart(chart_commits_per_author_#{i});
84
+ });
85
+ - else
86
+ $(document).ready(function() {
87
+ createDateAreaChart(chart_commits_per_author_#{i});
88
+ });
89
+
90
+ - if truncatedAuthors
91
+ .row
92
+ .col-md-12.alert.alert-danger Too many authors. Listing has been truncated!
@@ -0,0 +1,33 @@
1
+ - commits = stats.general_stats.commits
2
+ - age = ((stats.general_stats.last_commit - stats.general_stats.first_commit + 86399) / 86400).to_i + 1
3
+ - active = stats.general_stats.days
4
+ - block(:general,12) do
5
+ %table.table
6
+ %tbody
7
+ %tr
8
+ %th Generation time
9
+ %td&= Time.now.to_s
10
+ %tr
11
+ %th Authors
12
+ %td= '%d (average %.1f commits per author)' % [stats.num_authors, commits / stats.num_authors]
13
+ %tr
14
+ %th Commits
15
+ %td= '%d (average %.1f commits per active day, %.1f per all days)' % [commits, commits / active, commits / age]
16
+ %tr
17
+ %th Files
18
+ %td= '%d (%d added, %d deleted)' % [stats.general_stats.files, stats.general_stats.files_added, stats.general_stats.files_deleted]
19
+ %tr
20
+ %th Lines
21
+ %td= '%d (%d added, %d deleted)' % [stats.general_stats.lines, stats.general_stats.lines_added, stats.general_stats.lines_deleted]
22
+ %tr
23
+ %th Size
24
+ %td= '%d bytes' % stats.file_stats.size
25
+ %tr
26
+ %th First commit
27
+ %td= stats.general_stats.first_commit.to_s
28
+ %tr
29
+ %th Last commit
30
+ %td= stats.general_stats.last_commit.to_s
31
+ %tr
32
+ %th Age
33
+ %td= '%d / %d active days (%.2f%%)' % [active, age, active * 100.0 / age.to_f]
@@ -0,0 +1,41 @@
1
+ - commits = stats.general_stats.commits
2
+ - age = ((stats.general_stats.last_commit - stats.general_stats.first_commit + 86399) / 86400).to_i + 1
3
+ - active = stats.general_stats.days
4
+ - block(:globalstats,12) do
5
+ %ul.thumbnails
6
+ %li.span4
7
+ %div.thumbnail
8
+ %div.title Total commits
9
+ %div.value= commits
10
+ %li.span4
11
+ %div.thumbnail
12
+ %div.title Total contributors
13
+ %div.value= stats.num_authors
14
+ %li.span4
15
+ %div.thumbnail
16
+ %div.title First commit date
17
+ %div.value= stats.general_stats.first_commit.strftime("%F")
18
+ %li.span4
19
+ %div.thumbnail
20
+ %div.title Latest commit date
21
+ %div.value= stats.general_stats.last_commit.strftime("%F")
22
+ %li.span4
23
+ %div.thumbnail
24
+ %div.title Total days
25
+ %div.value= age
26
+ %li.span4
27
+ %div.thumbnail
28
+ %div.title Active days
29
+ %div.value= active
30
+ %li.span4
31
+ %div.thumbnail
32
+ %div.title Average commits per day
33
+ %div.value= "%.2f" % [commits.to_f / age]
34
+ %li.span4
35
+ %div.thumbnail
36
+ %div.title Average commits per active day
37
+ %div.value= "%.2f" % [commits.to_f / active]
38
+ %li.span4
39
+ %div.thumbnail
40
+ %div.title Average commits per contributor
41
+ %div.value= "%.2f" % [commits.to_f / stats.num_authors]
@@ -0,0 +1,12 @@
1
+ - block(:repos,12) do
2
+ %table.table
3
+ %thead
4
+ %th Name
5
+ %th Path
6
+ %th Ref
7
+ %tbody
8
+ - stats.repos.each do |repo|
9
+ %tr
10
+ %td&= repo.name
11
+ %td&= repo.base
12
+ %td&= repo.ref
@@ -0,0 +1,323 @@
1
+ function popUpGraph(existingChart) {
2
+ var options = existingChart.options;
3
+ var width = $('#myModal').width()*0.90;
4
+ var height = $('#myModal').height()*0.85;
5
+ var popupChart = new Highcharts.Chart(Highcharts.merge(options, {
6
+ chart: {
7
+ renderTo: 'modal-body',
8
+ width: width,
9
+ height: height
10
+ }
11
+ }));
12
+
13
+ $('#myModal').modal('show');
14
+ }
15
+
16
+ function createColumnChart(element){
17
+ $(element.target).highcharts({
18
+ chart: {
19
+ type: 'column'
20
+ },
21
+ title: {
22
+ text: element.label
23
+ },
24
+ credits: {
25
+ enabled: false
26
+ },
27
+ xAxis: {
28
+ categories: element.categories,
29
+ title: {
30
+ text: null
31
+ }
32
+ },
33
+ yAxis: [{
34
+ title: {
35
+ text: element.label_y_axis,
36
+ }
37
+ },{
38
+ title: {
39
+ text: element.label_y2_axis,
40
+ },
41
+ opposite: true
42
+ }],
43
+ plotOptions: {
44
+ column: {
45
+ pointPadding: 0.2,
46
+ borderWidth: 0,
47
+ stacking: 'normal'
48
+ }
49
+ },
50
+ tooltip: {
51
+ headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
52
+ pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
53
+ '<td style="padding:0"><b>{point.y}</b></td></tr>',
54
+ footerFormat: '</table>',
55
+ shared: true,
56
+ useHTML: true
57
+ },
58
+ series: element.series,
59
+ exporting: {
60
+ buttons: {
61
+ customButton: {
62
+ x: -40,
63
+ onclick: function () {
64
+ popUpGraph(this);
65
+ },
66
+ symbol: 'square'
67
+ }
68
+ }
69
+ }
70
+ });
71
+ }
72
+
73
+ function createAreaChart(element){
74
+ $(element.target).highcharts({
75
+ chart: {
76
+ type: 'areaspline',
77
+ zoomType: "x"
78
+ },
79
+ title: {
80
+ text: element.label
81
+ },
82
+ credits: {
83
+ enabled: false
84
+ },
85
+ legend: {
86
+ layout: 'vertical',
87
+ align: 'left',
88
+ verticalAlign: 'top',
89
+ x: 50,
90
+ y: 50,
91
+ floating: true,
92
+ borderWidth: 1,
93
+ backgroundColor: '#FFFFFF'
94
+ },
95
+ xAxis: {
96
+ categories: element.categories,
97
+ tickInterval: parseInt(element.categories.length / 12),
98
+ title: {
99
+ text: null
100
+ },
101
+ labels: {
102
+ rotation: -45,
103
+ y: 35
104
+ }
105
+ },
106
+ yAxis: [{
107
+ title: {
108
+ text: element.label_y_axis,
109
+ }
110
+ },{
111
+ title: {
112
+ text: element.label_y2_axis,
113
+ },
114
+ opposite: true
115
+ }],
116
+ tooltip: {
117
+ shared: true,
118
+ },
119
+ plotOptions: {
120
+ areaspline: {
121
+ fillOpacity: 0.2
122
+ }
123
+ },
124
+ series: element.series,
125
+ exporting: {
126
+ buttons: {
127
+ customButton: {
128
+ x: -40,
129
+ onclick: function () {
130
+ popUpGraph(this);
131
+ },
132
+ symbol: 'square'
133
+ }
134
+ }
135
+ }
136
+ });
137
+ }
138
+
139
+ function createDateAreaChart(element){
140
+ $(element.target).highcharts({
141
+ chart: {
142
+ type: 'areaspline',
143
+ zoomType: 'x'
144
+ },
145
+ title: {
146
+ text: element.label
147
+ },
148
+ credits: {
149
+ enabled: false
150
+ },
151
+ legend: {
152
+ layout: 'vertical',
153
+ align: 'left',
154
+ verticalAlign: 'top',
155
+ x: 50,
156
+ y: 50,
157
+ floating: true,
158
+ borderWidth: 1,
159
+ backgroundColor: '#FFFFFF'
160
+ },
161
+ xAxis: {
162
+ min: element.x_min,
163
+ max: element.x_max,
164
+ type: 'datetime',
165
+ title: {
166
+ text: 'Date'
167
+ },
168
+ labels: {
169
+ rotation: -45,
170
+ y: 35
171
+ }
172
+ },
173
+ yAxis: [{
174
+ title: {
175
+ text: element.label_y_axis,
176
+ }
177
+ },{
178
+ title: {
179
+ text: element.label_y2_axis,
180
+ },
181
+ opposite: true
182
+ }],
183
+ tooltip: {
184
+ shared: true,
185
+ },
186
+ plotOptions: {
187
+ areaspline: {
188
+ fillOpacity: 0.2
189
+ }
190
+ },
191
+ series: element.series,
192
+ exporting: {
193
+ buttons: {
194
+ customButton: {
195
+ x: -40,
196
+ onclick: function () {
197
+ popUpGraph(this);
198
+ },
199
+ symbol: 'square'
200
+ }
201
+ }
202
+ }
203
+ });
204
+ }
205
+
206
+ function createPieChart(element){
207
+ $(element.target).highcharts({
208
+ chart: {
209
+ type: "pie"
210
+ },
211
+ title: {
212
+ text: element.label
213
+ },
214
+ credits: {
215
+ enabled: false
216
+ },
217
+ yAxis: {
218
+ title: {
219
+ text: ""
220
+ }
221
+ },
222
+ series: element.series,
223
+ exporting: {
224
+ buttons: {
225
+ customButton: {
226
+ x: -40,
227
+ onclick: function () {
228
+ popUpGraph(this);
229
+ },
230
+ symbol: 'square'
231
+ }
232
+ }
233
+ }
234
+ });
235
+ }
236
+
237
+ function createBarChart(element){
238
+ $(element.target).highcharts({
239
+ chart: {
240
+ type: "bar"
241
+ },
242
+ title: {
243
+ text: element.label
244
+ },
245
+ credits: {
246
+ enabled: false
247
+ },
248
+ xAxis: {
249
+ categories: element.categories,
250
+ title: {
251
+ text: element.label_y_axis
252
+ }
253
+ },
254
+ yAxis: {
255
+ title: {
256
+ text: element.label_x_axis
257
+ }
258
+ },
259
+ series: element.series,
260
+ exporting: {
261
+ buttons: {
262
+ customButton: {
263
+ x: -40,
264
+ onclick: function () {
265
+ popUpGraph(this);
266
+ },
267
+ symbol: 'square'
268
+ }
269
+ }
270
+ }
271
+ });
272
+ }
273
+
274
+ function createHeatMap(element){
275
+ $(element.target).highcharts({
276
+ chart: {
277
+ type: 'heatmap'
278
+ },
279
+ title: {
280
+ text: element.label
281
+ },
282
+ credits: {
283
+ enabled: false
284
+ },
285
+ xAxis: {
286
+ categories: element.categories_x,
287
+ title: element.label_x
288
+ },
289
+ yAxis: {
290
+ categories: element.categories_y,
291
+ title: element.label_y
292
+ },
293
+ colorAxis: {
294
+ min: 0,
295
+ minColor: '#FFFFFF',
296
+ maxColor: Highcharts.getOptions().colors[0]
297
+ },
298
+ series: [{
299
+ name: element.series_name,
300
+ borderWidth: 1,
301
+ data: element.series_data,
302
+ dataLabels: {
303
+ enabled: true,
304
+ color: 'black',
305
+ style: {
306
+ textShadow: 'none',
307
+ HcTextStroke: null
308
+ }
309
+ }
310
+ }],
311
+ exporting: {
312
+ buttons: {
313
+ customButton: {
314
+ x: -40,
315
+ onclick: function () {
316
+ popUpGraph(this);
317
+ },
318
+ symbol: 'square'
319
+ }
320
+ }
321
+ }
322
+ });
323
+ }