@@ -388,6 +388,8 @@ export class LineChartService {
388
388
d3Select ( '.y-axis' ) . transition ( ) . call ( ( transition ) => this . updateYAxis ( transition , yNewScale , this . _width ) ) ;
389
389
// Redraw lines and dots
390
390
this . addDataLinesToChart ( chart , xScale , yScale , data ) ;
391
+ // Show marker
392
+ this . showMarker ( ) ;
391
393
} ;
392
394
393
395
const updateChart = ( chart : D3Selection < D3BaseType , { } , D3ContainerElement , { } > , xScale : D3ScaleTime < number , number > , yScale : D3ScaleLinear < number , number > , data : TimeSeries [ ] ) => {
@@ -857,22 +859,18 @@ export class LineChartService {
857
859
} )
858
860
}
859
861
862
+ private showMarker ( ) {
863
+ d3Select ( '.marker-line' ) . style ( 'opacity' , 1 ) ;
864
+ d3Select ( '#marker-tooltip' ) . style ( 'opacity' , 1 ) ;
865
+ } ;
866
+
860
867
private hideMarker ( ) {
861
868
d3Select ( '.marker-line' ) . style ( 'opacity' , 0 ) ;
862
869
d3Select ( '#marker-tooltip' ) . style ( 'opacity' , 0 ) ;
863
870
this . hideOldDotsOnMarker ( ) ;
864
871
} ;
865
872
866
873
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
-
876
874
return ( chart : D3Selection < D3BaseType , { } , D3ContainerElement , { } > ) => {
877
875
if ( ! chart . select ( '.chart-content' ) . empty ( ) ) {
878
876
return ;
@@ -884,7 +882,7 @@ export class LineChartService {
884
882
. attr ( 'width' , this . _width )
885
883
. attr ( 'height' , this . _height )
886
884
. attr ( 'fill' , 'none' )
887
- . on ( 'mouseenter' , ( ) => showMarker ( ) )
885
+ . on ( 'mouseenter' , ( ) => this . showMarker ( ) )
888
886
. on ( 'mouseleave' , ( ) => this . hideMarker ( ) )
889
887
. on ( "contextmenu" , ( ) => d3Event . preventDefault ( ) )
890
888
. on ( 'mousemove' , ( _ , index , nodes : D3ContainerElement [ ] ) => {
0 commit comments