@@ -49,7 +49,7 @@ class CFDRenderer extends UIControlsRenderer {
4949 * }
5050 * ];
5151 */
52- constructor ( data , states = [ 'analysis_active' , 'analysis_done' , 'in_progress' , 'dev_complete' , 'verification_start' , 'delivered' ] ) {
52+ constructor ( data , states ) {
5353 super ( data ) ;
5454 this . states = states ;
5555 this . #statesColors = d3 . scaleOrdinal ( ) . domain ( this . states ) . range ( this . #colorPalette) ;
@@ -142,7 +142,8 @@ class CFDRenderer extends UIControlsRenderer {
142142 this . reportingRangeDays = calculateDaysBetweenDates ( domain [ 0 ] , domain [ 1 ] )
143143 this . currentXScale = this . x . copy ( ) . domain ( domain ) ;
144144 this . currentYScale = this . y . copy ( ) . domain ( [ 0 , maxY ] ) . nice ( ) ;
145- this . drawXAxis ( this . gx , this . currentXScale , this . height ) ;
145+ this . changeTimeInterval ( false , "cfd" ) ;
146+ this . drawXAxis ( this . gx , this . currentXScale , this . height , true ) ;
146147 this . drawYAxis ( this . gy , this . currentYScale ) ;
147148
148149 this . chartArea
@@ -178,7 +179,7 @@ class CFDRenderer extends UIControlsRenderer {
178179 */
179180 #drawArea( ) {
180181 this . chartArea = this . addClipPath ( this . svg , 'cfd-clip' ) ;
181- // this.chartArea.append('rect').attr('width', '100%').attr('height', '100%').attr('id', 'cfd-area').attr('fill', 'transparent');
182+ this . chartArea . append ( 'rect' ) . attr ( 'width' , '100%' ) . attr ( 'height' , '100%' ) . attr ( 'id' , 'cfd-area' ) . attr ( 'fill' , 'transparent' ) ;
182183 const areaGenerator = this . #createAreaGenerator( this . x , this . y ) ;
183184 this . #drawStackedAreaChart( this . chartArea , this . #stackedData, areaGenerator ) ;
184185 this . #drawLegend( ) ;
@@ -323,7 +324,7 @@ class CFDRenderer extends UIControlsRenderer {
323324 * @param isGraph
324325 */
325326 drawXAxis ( g , x , height = this . height , isGraph = false ) {
326- const axis = this . createXAxis ( x ) ;
327+ let axis ;
327328 const clipId = 'cfd-x-axis-clip' ;
328329 this . svg
329330 . append ( 'clipPath' )
@@ -334,6 +335,7 @@ class CFDRenderer extends UIControlsRenderer {
334335 . attr ( 'width' , this . width )
335336 . attr ( 'height' , this . height ) ;
336337 if ( isGraph ) {
338+ axis = this . createXAxis ( x ) ;
337339 const axisGroup = g . call ( axis ) . attr ( 'transform' , `translate(0, ${ height } )` ) ;
338340 const axisPath = axisGroup
339341 . selectAll ( 'path' )
@@ -353,6 +355,7 @@ class CFDRenderer extends UIControlsRenderer {
353355 g . selectAll ( 'text' ) . attr ( 'y' , 30 ) . style ( 'fill' , 'black' ) ;
354356 g . attr ( 'clip-path' , `url(#${ clipId } )` ) ;
355357 } else {
358+ axis = this . createXAxis ( x , "months" ) ;
356359 g . call ( axis ) . attr ( 'transform' , `translate(0, ${ height } )` ) ;
357360 }
358361 }
@@ -554,10 +557,25 @@ class CFDRenderer extends UIControlsRenderer {
554557 #handleMouseEvent( event , eventName ) {
555558 if ( this . #areMetricsEnabled) {
556559 this . #removeMetricsLines( ) ;
557- const coords = d3 . pointer ( event , d3 . select ( '#cfd-area' ) . node ( ) ) ; // Get the mouse x-position
560+ const coords = d3 . pointer ( event , d3 . select ( '#cfd-area' ) . node ( ) ) ;
558561 const xPosition = coords [ 0 ] ;
559562 const yPosition = coords [ 1 ] ;
563+
564+ // Debug logs
565+ // console.log("coords:", coords);
566+ // console.log("xPosition:", xPosition, "yPosition:", yPosition);
567+ // console.log("currentXScale domain:", this.currentXScale.domain());
568+ // console.log("currentXScale range:", this.currentXScale.range());
569+
570+ // Ensure xPosition is within the chart's range
571+ if ( xPosition < 0 || xPosition > this . width ) {
572+ console . log ( "xPosition out of bounds:" , xPosition ) ;
573+ return ;
574+ }
575+
560576 const date = this . currentXScale . invert ( xPosition ) ;
577+ // console.log("pointer", date, event, coords);
578+
561579 const cumulativeCountOfWorkItems = this . currentYScale . invert ( yPosition ) ;
562580 const excludeCycleTime = eventName === 'scatterplot-mousemove' ;
563581
@@ -597,7 +615,7 @@ class CFDRenderer extends UIControlsRenderer {
597615 */
598616 computeMetrics ( currentDate , currentCumulativeCount , excludeCycleTime = false ) {
599617 currentDate = new Date ( currentDate ) ;
600- currentDate . setUTCHours ( 0 , 0 , 0 , 0 ) ;
618+ // currentDate.setUTCHours(0, 0, 0, 0);
601619 const currentDataEntry = this . data . find ( ( d ) => areDatesEqual ( new Date ( d . date ) , currentDate ) ) ;
602620 if ( currentDataEntry ) {
603621 const filteredData = this . data . filter ( ( d ) => d . date <= currentDate ) . reverse ( ) ;
0 commit comments