@@ -193,6 +193,9 @@ exports.loneHover = function loneHover(hoverItems, opts) {
193193 fontFamily : hoverItem . fontFamily ,
194194 fontSize : hoverItem . fontSize ,
195195 fontColor : hoverItem . fontColor ,
196+ fontWeight : hoverItem . fontWeight ,
197+ fontStyle : hoverItem . fontStyle ,
198+ fontVariant : hoverItem . fontVariant ,
196199 nameLength : hoverItem . nameLength ,
197200 textAlign : hoverItem . textAlign ,
198201
@@ -955,6 +958,9 @@ function createHoverText(hoverData, opts) {
955958 // can override this.
956959 var fontFamily = opts . fontFamily || constants . HOVERFONT ;
957960 var fontSize = opts . fontSize || constants . HOVERFONTSIZE ;
961+ var fontWeight = opts . fontWeight || fullLayout . font . weight ;
962+ var fontStyle = opts . fontStyle || fullLayout . font . style ;
963+ var fontVariant = opts . fontVariant || fullLayout . font . variant ;
958964
959965 var c0 = hoverData [ 0 ] ;
960966 var xa = c0 . xa ;
@@ -1036,6 +1042,9 @@ function createHoverText(hoverData, opts) {
10361042 var commonStroke = commonLabelOpts . bordercolor || Color . contrast ( commonBgColor ) ;
10371043 var contrastColor = Color . contrast ( commonBgColor ) ;
10381044 var commonLabelFont = {
1045+ weight : commonLabelOpts . font . weight || fontWeight ,
1046+ style : commonLabelOpts . font . style || fontStyle ,
1047+ variant : commonLabelOpts . font . variant || fontVariant ,
10391048 family : commonLabelOpts . font . family || fontFamily ,
10401049 size : commonLabelOpts . font . size || fontSize ,
10411050 color : commonLabelOpts . font . color || contrastColor
@@ -1357,7 +1366,13 @@ function createHoverText(hoverData, opts) {
13571366 g . append ( 'path' )
13581367 . style ( 'stroke-width' , '1px' ) ;
13591368 g . append ( 'text' ) . classed ( 'nums' , true )
1360- . call ( Drawing . font , fontFamily , fontSize ) ;
1369+ . call ( Drawing . font , {
1370+ weight : fontWeight ,
1371+ style : fontStyle ,
1372+ variant : fontVariant ,
1373+ family : fontFamily ,
1374+ size : fontSize
1375+ } ) ;
13611376 } ) ;
13621377 hoverLabels . exit ( ) . remove ( ) ;
13631378
@@ -1392,10 +1407,14 @@ function createHoverText(hoverData, opts) {
13921407
13931408 // main label
13941409 var tx = g . select ( 'text.nums' )
1395- . call ( Drawing . font ,
1396- d . fontFamily || fontFamily ,
1397- d . fontSize || fontSize ,
1398- d . fontColor || contrastColor )
1410+ . call ( Drawing . font , {
1411+ family : d . fontFamily || fontFamily ,
1412+ size : d . fontSize || fontSize ,
1413+ color : d . fontColor || contrastColor ,
1414+ weight : d . fontWeight || fontWeight ,
1415+ style : d . fontStyle || fontStyle ,
1416+ variant : d . fontVariant || fontVariant
1417+ } )
13991418 . text ( text )
14001419 . attr ( 'data-notex' , 1 )
14011420 . call ( svgTextUtils . positionText , 0 , 0 )
@@ -1407,11 +1426,14 @@ function createHoverText(hoverData, opts) {
14071426
14081427 // secondary label for non-empty 'name'
14091428 if ( name && name !== text ) {
1410- tx2 . call ( Drawing . font ,
1411- d . fontFamily || fontFamily ,
1412- d . fontSize || fontSize ,
1413- nameColor )
1414- . text ( name )
1429+ tx2 . call ( Drawing . font , {
1430+ family : d . fontFamily || fontFamily ,
1431+ size : d . fontSize || fontSize ,
1432+ color : nameColor ,
1433+ weight : d . fontWeight || fontWeight ,
1434+ style : d . fontStyle || fontStyle ,
1435+ variant : d . fontVariant || fontVariant
1436+ } ) . text ( name )
14151437 . attr ( 'data-notex' , 1 )
14161438 . call ( svgTextUtils . positionText , 0 , 0 )
14171439 . call ( svgTextUtils . convertToTspans , gd ) ;
@@ -1954,6 +1976,9 @@ function cleanPoint(d, hovermode) {
19541976 fill ( 'fontFamily' , 'htf' , 'hoverlabel.font.family' ) ;
19551977 fill ( 'fontSize' , 'hts' , 'hoverlabel.font.size' ) ;
19561978 fill ( 'fontColor' , 'htc' , 'hoverlabel.font.color' ) ;
1979+ fill ( 'fontWeight' , 'htw' , 'hoverlabel.font.weight' ) ;
1980+ fill ( 'fontStyle' , 'hty' , 'hoverlabel.font.style' ) ;
1981+ fill ( 'fontVariant' , 'htv' , 'hoverlabel.font.variant' ) ;
19571982 fill ( 'nameLength' , 'hnl' , 'hoverlabel.namelength' ) ;
19581983 fill ( 'textAlign' , 'hta' , 'hoverlabel.align' ) ;
19591984
0 commit comments