@@ -46,7 +46,9 @@ class MyTooltipLabel extends React.PureComponent<ChartLabelProps> {
46
46
}
47
47
}
48
48
49
- class MyTooltipLegendLabel extends React . PureComponent < ChartLegendLabelProps > {
49
+ class MyTooltipLegendLabel extends React . PureComponent <
50
+ ChartLegendLabelProps & { styleOverride ?: ChartLegendLabelProps [ "style" ] }
51
+ > {
50
52
public render ( ) {
51
53
const dx =
52
54
typeof this . props . dx === "number"
@@ -58,7 +60,7 @@ class MyTooltipLegendLabel extends React.PureComponent<ChartLegendLabelProps> {
58
60
< ChartLegendTooltipLabel
59
61
{ ...this . props }
60
62
dx = { ( ( dx || 0 ) * BaseChart . legendLabelStyle . fontSize ) / 14 }
61
- style = { BaseChart . legendLabelStyle }
63
+ style = { this . props . styleOverride || BaseChart . legendLabelStyle }
62
64
legendLabelComponent = { < MyTooltipLabel /> }
63
65
/>
64
66
)
@@ -71,7 +73,7 @@ class MyTooltipContent extends React.PureComponent<ChartLegendTooltipContentProp
71
73
< ChartLegendTooltipContent
72
74
{ ...this . props }
73
75
labelComponent = { < MyTooltipLegendLabel /> }
74
- titleComponent = { < ChartLabel style = { BaseChart . legendTitleStyle } /> }
76
+ titleComponent = { < MyTooltipLegendLabel styleOverride = { BaseChart . legendTitleStyle } /> }
75
77
/>
76
78
)
77
79
}
@@ -353,10 +355,10 @@ export default class BaseChart extends React.PureComponent<Props> {
353
355
354
356
/** @return the `legendData` model for `<ChartLegendTooltip/>` */
355
357
private getLegendData ( chart : BaseChartProps ) : ChartLegendTooltipProps [ "legendData" ] {
356
- return chart . series . map ( ( { data, stroke, fill } ) => ( {
358
+ return chart . series . map ( ( { data, stroke, fill, impl } ) => ( {
357
359
childName : data [ 0 ] . name ,
358
360
name : data [ 0 ] . name ?. replace ( / ^ \S + \s * / , "" ) ,
359
- symbol : { fill : fill || stroke } ,
361
+ symbol : { fill : fill || stroke , type : impl === "ChartDashedLine" ? "dash" : undefined } ,
360
362
} ) )
361
363
}
362
364
@@ -389,6 +391,8 @@ export default class BaseChart extends React.PureComponent<Props> {
389
391
domain = { chart . domain }
390
392
containerComponent = {
391
393
< CursorVoronoiContainer
394
+ mouseFollowTooltips
395
+ voronoiDimension = "x"
392
396
labels = { this . getTooltipLabels . bind ( this , formatMap ) }
393
397
labelComponent = {
394
398
< ChartLegendTooltip
@@ -399,8 +403,6 @@ export default class BaseChart extends React.PureComponent<Props> {
399
403
title = { ( datum : any ) => `${ new Date ( datum . x + this . props . timeRange . min ) . toLocaleString ( ) } ` }
400
404
/>
401
405
}
402
- mouseFollowTooltips
403
- voronoiPadding = { 20 }
404
406
/>
405
407
}
406
408
>
0 commit comments