@@ -388,6 +388,8 @@ export class LineChartService {
388388 d3Select ( '.y-axis' ) . transition ( ) . call ( ( transition ) => this . updateYAxis ( transition , yNewScale , this . _width ) ) ;
389389 // Redraw lines and dots
390390 this . addDataLinesToChart ( chart , xScale , yScale , data ) ;
391+ // Show marker
392+ this . showMarker ( ) ;
391393 } ;
392394
393395 const updateChart = ( chart : D3Selection < D3BaseType , { } , D3ContainerElement , { } > , xScale : D3ScaleTime < number , number > , yScale : D3ScaleLinear < number , number > , data : TimeSeries [ ] ) => {
@@ -857,22 +859,18 @@ export class LineChartService {
857859 } )
858860 }
859861
862+ private showMarker ( ) {
863+ d3Select ( '.marker-line' ) . style ( 'opacity' , 1 ) ;
864+ d3Select ( '#marker-tooltip' ) . style ( 'opacity' , 1 ) ;
865+ } ;
866+
860867 private hideMarker ( ) {
861868 d3Select ( '.marker-line' ) . style ( 'opacity' , 0 ) ;
862869 d3Select ( '#marker-tooltip' ) . style ( 'opacity' , 0 ) ;
863870 this . hideOldDotsOnMarker ( ) ;
864871 } ;
865872
866873 private prepareMouseEventCatcher = ( ( ) => {
867- const showMarker = ( ) => {
868- if ( this . _dotsOnMarker && this . _dotsOnMarker . empty ( ) ) {
869- return ;
870- }
871-
872- d3Select ( '.marker-line' ) . style ( 'opacity' , 1 ) ;
873- d3Select ( '#marker-tooltip' ) . style ( 'opacity' , 1 ) ;
874- } ;
875-
876874 return ( chart : D3Selection < D3BaseType , { } , D3ContainerElement , { } > ) => {
877875 if ( ! chart . select ( '.chart-content' ) . empty ( ) ) {
878876 return ;
@@ -884,7 +882,7 @@ export class LineChartService {
884882 . attr ( 'width' , this . _width )
885883 . attr ( 'height' , this . _height )
886884 . attr ( 'fill' , 'none' )
887- . on ( 'mouseenter' , ( ) => showMarker ( ) )
885+ . on ( 'mouseenter' , ( ) => this . showMarker ( ) )
888886 . on ( 'mouseleave' , ( ) => this . hideMarker ( ) )
889887 . on ( "contextmenu" , ( ) => d3Event . preventDefault ( ) )
890888 . on ( 'mousemove' , ( _ , index , nodes : D3ContainerElement [ ] ) => {
0 commit comments