Quellcode durchsuchen

Graph: Commits by year/month.

Heikki Hokkanen vor 18 Jahren
Ursprung
Commit
b69d1a7b66
2 geänderte Dateien mit 19 neuen und 3 gelöschten Zeilen
  1. 0
    1
      TODO.txt
  2. 19
    2
      statgit

+ 0
- 1
TODO.txt Datei anzeigen

@@ -1,7 +1,6 @@
1 1
 []
2 2
 - copy/link statgit.css to target dir
3 3
 - Activity: gnuplot graphs of tables
4
-	- Commits by year/month
5 4
 
6 5
 - development statistics generator for git
7 6
 	- should be as versatile as statcvs / statsvn

+ 19
- 2
statgit Datei anzeigen

@@ -323,6 +323,11 @@ class HTMLReportCreator(ReportCreator):
323 323
 		for yymm in reversed(sorted(data.commits_by_month.keys())):
324 324
 			f.write('<tr><td>%s</td><td>%d</td></tr>' % (yymm, data.commits_by_month[yymm]))
325 325
 		f.write('</table>')
326
+		f.write('<img src="commits_by_year_month.png" />')
327
+		fg = open(path + '/commits_by_year_month.dat', 'w')
328
+		for yymm in sorted(data.commits_by_month.keys()):
329
+			fg.write('%s %s\n' % (yymm, data.commits_by_month[yymm]))
330
+		fg.close()
326 331
 
327 332
 		# Commits by year
328 333
 		f.write('<h2>Commits by year</h2>')
@@ -421,17 +426,29 @@ class HTMLReportCreator(ReportCreator):
421 426
 	pass
422 427
 	
423 428
 	def createGraphs(self, path):
429
+		print 'Generating graphs...'
430
+
431
+		# commits_by_year_month
432
+		f = open(path + '/commits_by_year_month.plot', 'w')
433
+		f.write(GNUPLOT_COMMON)
434
+		f.write('set output \'commits_by_year_month.png\'\n')
435
+		f.write('unset key\n')
436
+		f.write('set xdata time\nset timefmt "%Y-%m"\nset format x "%Y-%m"\n')
437
+		f.write('plot \'commits_by_year_month.dat\' using 1:2:(0.5) w boxes fs solid')
438
+		f.close()
439
+
424 440
 		# commits_by_year
425 441
 		f = open(path + '/commits_by_year.plot', 'w')
426 442
 		f.write(GNUPLOT_COMMON)
427 443
 		f.write('set output \'commits_by_year.png\'\n')
428 444
 		f.write('unset key\n')
429 445
 		f.write('set xtics 1\n')
430
-		f.write('plot \'commits_by_year.dat\' using 1:2 w lp')
446
+		f.write('plot \'commits_by_year.dat\' using 1:2:(0.5) w boxes fs solid')
431 447
 		f.close()
432 448
 
433 449
 		os.chdir(path)
434
-		os.system('gnuplot commits_by_year.plot')
450
+		for i in ('commits_by_year_month', 'commits_by_year'):
451
+			os.system('gnuplot %s.plot' % i)
435 452
 
436 453
 		pass
437 454