@@ -880,7 +880,10 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
880
880
] ) ;
881
881
}
882
882
883
- if ( isLegendSelected ) {
883
+ // Check if lines should be drawn based on mode
884
+ const lineMode = this . _points [ i ] . lineOptions ?. mode ;
885
+ const shouldDrawLines = lineMode !== 'markers' ;
886
+ if ( shouldDrawLines && isLegendSelected ) {
884
887
const lineBorderWidth = this . _points [ i ] . lineOptions ?. lineBorderWidth
885
888
? Number . parseFloat ( this . _points [ i ] . lineOptions ! . lineBorderWidth ! . toString ( ) )
886
889
: 0 ;
@@ -917,7 +920,7 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
917
920
opacity = { 1 }
918
921
/> ,
919
922
) ;
920
- } else {
923
+ } else if ( shouldDrawLines ) {
921
924
linesForLine . push (
922
925
< path
923
926
id = { lineId }
@@ -935,6 +938,8 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
935
938
}
936
939
937
940
const isPointHighlighted = this . state . activeLine !== null && this . state . activeLine === i ;
941
+
942
+ // Always add the highlight circle for large dataset hover
938
943
pointsForLine . push (
939
944
< circle
940
945
id = { `${ this . _staticHighlightCircle } _${ i } ` }
@@ -951,6 +956,46 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
951
956
onMouseOut = { this . _handleMouseOut }
952
957
/> ,
953
958
) ;
959
+
960
+ // Add individual markers if mode includes 'markers'
961
+ const showMarkers = lineMode ?. includes ( 'markers' ) || ! lineMode ; // Show markers by default if no mode specified
962
+ if ( showMarkers ) {
963
+ for ( let k = 0 ; k < this . _points [ i ] . data . length ; k ++ ) {
964
+ const { x, y } = this . _points [ i ] . data [ k ] ;
965
+ const xPoint = this . _xAxisScale ( x instanceof Date ? x . getTime ( ) : x ) ;
966
+ const yPoint = yScale ( y ) ;
967
+
968
+ if ( isPlottable ( xPoint , yPoint ) ) {
969
+ const markerSize = this . _points [ i ] . data [ k ] . markerSize ;
970
+ const perPointColor = this . _points [ i ] . data [ k ] ?. markerColor ;
971
+ pointsForLine . push (
972
+ < circle
973
+ key = { `${ this . _circleId } _${ i } _${ k } _marker` }
974
+ r = {
975
+ markerSize
976
+ ? ( markerSize ! * extraMaxPixels * 0.3 ) / maxMarkerSize
977
+ : activePoint === this . _circleId
978
+ ? 5.5
979
+ : 3.5
980
+ }
981
+ cx = { xPoint }
982
+ cy = { yPoint }
983
+ fill = {
984
+ activePoint === this . _circleId
985
+ ? theme ! . semanticColors . bodyBackground
986
+ : perPointColor || this . _points [ i ] ?. color || lineColor
987
+ }
988
+ stroke = { perPointColor || lineColor }
989
+ strokeWidth = { 1 }
990
+ opacity = { isLegendSelected ? 1 : 0.1 }
991
+ onMouseMove = { this . _onMouseOverLargeDataset . bind ( this , i , verticaLineHeight , yScale ) }
992
+ onMouseOver = { this . _onMouseOverLargeDataset . bind ( this , i , verticaLineHeight , yScale ) }
993
+ onMouseOut = { this . _handleMouseOut }
994
+ /> ,
995
+ ) ;
996
+ }
997
+ }
998
+ }
954
999
} else if ( ! this . props . optimizeLargeData ) {
955
1000
for ( let j = 1 ; j < this . _points [ i ] . data . length ; j ++ ) {
956
1001
const gapResult = this . _checkInGap ( j , gaps , gapIndex ) ;
@@ -1019,8 +1064,8 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
1019
1064
onBlur = { this . _handleMouseOut }
1020
1065
{ ...this . _getClickHandler ( this . _points [ i ] . data [ j - 1 ] . onDataPointClick ) }
1021
1066
opacity = { isLegendSelected && ! currentPointHidden ? 1 : 0.01 }
1022
- fill = { this . _getPointFill ( lineColor , circleId , j , false ) }
1023
- stroke = { lineColor }
1067
+ fill = { this . _points [ i ] . data [ j - 1 ] ?. markerColor || this . _getPointFill ( lineColor , circleId , j , false ) }
1068
+ stroke = { this . _points [ i ] . data [ j - 1 ] ?. markerColor || lineColor }
1024
1069
strokeWidth = { strokeWidth }
1025
1070
role = "img"
1026
1071
aria-label = { this . _points [ i ] . data [ j - 1 ] . text ?? this . _getAriaLabel ( i , j - 1 ) }
@@ -1078,8 +1123,8 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
1078
1123
onBlur = { this . _handleMouseOut }
1079
1124
{ ...this . _getClickHandler ( this . _points [ i ] . data [ j - 1 ] . onDataPointClick ) }
1080
1125
opacity = { isLegendSelected && ! currentPointHidden ? 1 : 0.01 }
1081
- fill = { this . _getPointFill ( lineColor , circleId , j , false ) }
1082
- stroke = { lineColor }
1126
+ fill = { this . _points [ i ] . data [ j - 1 ] ?. markerColor || this . _getPointFill ( lineColor , circleId , j , false ) }
1127
+ stroke = { this . _points [ i ] . data [ j - 1 ] ?. markerColor || lineColor }
1083
1128
strokeWidth = { strokeWidth }
1084
1129
role = "img"
1085
1130
aria-label = { this . _getAriaLabel ( i , j - 1 ) }
@@ -1214,8 +1259,10 @@ export class LineChartBase extends React.Component<ILineChartProps, ILineChartSt
1214
1259
onBlur = { this . _handleMouseOut }
1215
1260
{ ...this . _getClickHandler ( this . _points [ i ] . data [ j ] . onDataPointClick ) }
1216
1261
opacity = { isLegendSelected && ! lastPointHidden ? 1 : 0.01 }
1217
- fill = { this . _getPointFill ( lineColor , lastCircleId , j , true ) }
1218
- stroke = { lineColor }
1262
+ fill = {
1263
+ this . _points [ i ] . data [ j ] ?. markerColor || this . _getPointFill ( lineColor , lastCircleId , j , true )
1264
+ }
1265
+ stroke = { this . _points [ i ] . data [ j ] ?. markerColor || lineColor }
1219
1266
strokeWidth = { strokeWidth }
1220
1267
role = "img"
1221
1268
aria-label = { this . _getAriaLabel ( i , j ) }
0 commit comments