@@ -333,6 +333,38 @@ function buildHourByAuthorChart(hourOfDayData) {
333333 } ) ;
334334}
335335
336+ function buildHourByAuthorChart ( chartName , dataValue ) {
337+ const HOUR_LABELS = Array . from ( { length : 24 } , ( _ , i ) => String ( i ) ) ;
338+
339+ renderChart ( chartName , {
340+ type : "bar" ,
341+ data : {
342+ labels : HOUR_LABELS ,
343+ datasets : [ {
344+ data : dataValue ,
345+ stack : "commits" ,
346+ borderWidth : 1 ,
347+ backgroundColor : "#74c0fc"
348+ } ]
349+ } ,
350+ options : {
351+ responsive : true ,
352+ plugins : {
353+ legend : { position : "bottom" , display : false } ,
354+ tooltip : {
355+ callbacks : {
356+ label : ( c ) => `${ c . dataset . label } : ${ c . parsed . y } `
357+ }
358+ }
359+ } ,
360+ scales : {
361+ x : { stacked : true } ,
362+ y : { stacked : true , beginAtZero : true , ticks : { precision : 0 } }
363+ }
364+ }
365+ } ) ;
366+ }
367+
336368function buildWeekByAuthorChart ( dayOfWeekData ) {
337369 const WEEK_LABELS = [ "Monday" , "Tuesday" , "Wednesday" , "Thursday" , "Friday" , "Saturday" , "Sunday" ] ;
338370
@@ -644,17 +676,25 @@ function renderAccordionAuthors(stats) {
644676 const authorsList = Object . keys ( stats . authors_statistics . authors ) . sort ( ) ;
645677
646678 const accordion = document . getElementById ( "accordionAuthors" ) ;
679+ accordion . innerHTML = "" ;
680+
647681
648682 authorsList . forEach ( ( author , index ) => {
649683 const collapseId = `collapse-${ index } ` ;
650684 const chartExtensionsId = `chartExtensions-${ index } ` ;
685+
651686 const chartCommitTypesId = `chartCommitTypes-${ index } ` ;
652687 const chartCommitTypesLabels = Object . keys ( stats . commit_type . author_commit_type_counter [ author ] ) ;
653688 const chartCommitTypesValues = Object . values ( stats . commit_type . author_commit_type_counter [ author ] ) ;
654689
690+ const chartDayId = `chartDay-${ index } ` ;
691+
692+ const chartDayValues = Object . keys ( stats . historical_statistics . hour_of_day ) . map ( h => stats . historical_statistics . hour_of_day [ h ] [ author ] || 0 ) ;
693+
694+
655695 const item = document . createElement ( "div" ) ;
656696 item . className = "accordion-item" ;
657- item . innerHTML + = `
697+ item . innerHTML = `
658698 <div class="accordion-item">
659699 <h2 class="accordion-header" id="heading-${ index } ">
660700 <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#${ collapseId } " aria-expanded="false" aria-controls="${ collapseId } ">
@@ -672,17 +712,20 @@ function renderAccordionAuthors(stats) {
672712 <div class="col-md-4">
673713 <canvas id="${ chartCommitTypesId } "></canvas>
674714 </div>
715+ <div class="col-md-8">
716+ <canvas id="${ chartDayId } "></canvas>
717+ </div>
675718 </div>
676719 </div>
677- </div>
678- </div>
720+ </div>
679721 ` ;
680722
681723 accordion . appendChild ( item ) ;
682724
683725 setTimeout ( ( ) => {
684726 SubRenderExtensionsHorizontalBar ( chartExtensionsId , stats . language_statistics . files_extensions_by_author [ author ] ) ;
685- subRenderCommitsByAuthor ( chartCommitTypesId , chartCommitTypesLabels , chartCommitTypesValues )
727+ subRenderCommitsByAuthor ( chartCommitTypesId , chartCommitTypesLabels , chartCommitTypesValues ) ;
728+ buildHourByAuthorChart ( chartDayId , chartDayValues ) ;
686729 } , 0 ) ;
687730 } ) ;
688731}
0 commit comments