瀏覽代碼

Graph: Hour of Day.

Heikki Hokkanen 18 年之前
父節點
當前提交
0a0257fb56
共有 1 個文件被更改,包括 22 次插入1 次删除
  1. 22
    1
      statgit

+ 22
- 1
statgit 查看文件

@@ -297,6 +297,14 @@ class HTMLReportCreator(ReportCreator):
297 297
 			else:
298 298
 				f.write('<td>0.00</td>')
299 299
 		f.write('</tr></table>')
300
+		f.write('<img src="hour_of_day.png" />')
301
+		fg = open(path + '/hour_of_day.dat', 'w')
302
+		for i in range(0, 24):
303
+			if i in hour_of_day:
304
+				fg.write('%d %d\n' % (i + 1, hour_of_day[i]))
305
+			else:
306
+				fg.write('%d 0\n' % (i + 1))
307
+		fg.close()
300 308
 
301 309
 		# Day of Week
302 310
 		# TODO show also by hour of weekday?
@@ -428,6 +436,19 @@ class HTMLReportCreator(ReportCreator):
428 436
 	def createGraphs(self, path):
429 437
 		print 'Generating graphs...'
430 438
 
439
+		# hour of day
440
+		f = open(path + '/hour_of_day.plot', 'w')
441
+		f.write(GNUPLOT_COMMON)
442
+		f.write(
443
+"""
444
+set output 'hour_of_day.png'
445
+unset key
446
+set xrange [0.5:24.5]
447
+set xtics 4
448
+plot 'hour_of_day.dat' using 1:2:(0.5) w boxes fs solid
449
+""")
450
+		f.close()
451
+
431 452
 		# commits_by_year_month
432 453
 		f = open(path + '/commits_by_year_month.plot', 'w')
433 454
 		f.write(GNUPLOT_COMMON)
@@ -456,7 +477,7 @@ plot 'commits_by_year.dat' using 1:2:(0.5) w boxes fs solid
456 477
 		f.close()
457 478
 
458 479
 		os.chdir(path)
459
-		for i in ('commits_by_year_month', 'commits_by_year'):
480
+		for i in ('hour_of_day', 'commits_by_year_month', 'commits_by_year'):
460 481
 			os.system('gnuplot %s.plot' % i)
461 482
 
462 483
 		pass