@@ -12,6 +12,7 @@ var lineLayerMaker = require('./lines');
12
12
var c = require ( './constants' ) ;
13
13
var Lib = require ( '../../lib' ) ;
14
14
var d3 = require ( 'd3' ) ;
15
+ var Drawing = require ( '../../components/drawing' ) ;
15
16
16
17
17
18
function keyFun ( d ) { return d . key ; }
@@ -122,7 +123,10 @@ function model(layout, d, i) {
122
123
line = trace . line ,
123
124
domain = trace . domain ,
124
125
dimensions = trace . dimensions ,
125
- width = layout . width ;
126
+ width = layout . width ,
127
+ labelFont = trace . labelfont ,
128
+ tickFont = trace . tickfont ,
129
+ rangeFont = trace . rangefont ;
126
130
127
131
var lines = Lib . extendDeep ( { } , line , {
128
132
color : lineColor . map ( domainToUnitScale ( { values : lineColor , range : [ line . cmin , line . cmax ] } ) ) ,
@@ -144,6 +148,9 @@ function model(layout, d, i) {
144
148
tickDistance : c . tickDistance ,
145
149
unitToColor : unitToColorScale ( cscale ) ,
146
150
lines : lines ,
151
+ labelFont : labelFont ,
152
+ tickFont : tickFont ,
153
+ rangeFont : rangeFont ,
147
154
translateX : domain . x [ 0 ] * width ,
148
155
translateY : layout . height - domain . y [ 1 ] * layout . height ,
149
156
pad : pad ,
@@ -227,8 +234,6 @@ function styleExtentTexts(selection) {
227
234
selection
228
235
. classed ( 'axisExtentText' , true )
229
236
. attr ( 'text-anchor' , 'middle' )
230
- . style ( 'font-weight' , 100 )
231
- . style ( 'font-size' , '10px' )
232
237
. style ( 'cursor' , 'default' )
233
238
. style ( 'user-select' , 'none' ) ;
234
239
}
@@ -545,6 +550,7 @@ module.exports = function(root, svg, styledData, layout, callbacks) {
545
550
var scale = d . domainScale ;
546
551
var sdom = scale . domain ( ) ;
547
552
var texts = d . ticktext ;
553
+ Drawing . font ( axis , d . model . tickFont )
548
554
d3 . select ( this )
549
555
. call ( d3 . svg . axis ( )
550
556
. orient ( 'left' )
@@ -567,8 +573,6 @@ module.exports = function(root, svg, styledData, layout, callbacks) {
567
573
568
574
axis
569
575
. selectAll ( 'text' )
570
- . style ( 'font-weight' , 100 )
571
- . style ( 'font-size' , '10px' )
572
576
. style ( 'fill' , 'black' )
573
577
. style ( 'fill-opacity' , 1 )
574
578
. style ( 'stroke' , 'none' )
@@ -590,15 +594,14 @@ module.exports = function(root, svg, styledData, layout, callbacks) {
590
594
. append ( 'text' )
591
595
. classed ( 'axisTitle' , true )
592
596
. attr ( 'text-anchor' , 'middle' )
593
- . style ( 'font-family' , 'sans-serif' )
594
- . style ( 'font-size' , '10px' )
595
597
. style ( 'cursor' , 'ew-resize' )
596
598
. style ( 'user-select' , 'none' )
597
599
. style ( 'pointer-events' , 'auto' ) ;
598
600
599
601
axisTitle
600
602
. attr ( 'transform' , 'translate(0,' + - c . axisTitleOffset + ')' )
601
- . text ( function ( d ) { return d . label ; } ) ;
603
+ . text ( function ( d ) { return d . label ; } )
604
+ . each ( function ( d ) { Drawing . font ( axisTitle , d . model . labelFont ) ; } ) ;
602
605
603
606
var axisExtent = axisOverlays . selectAll ( '.axisExtent' )
604
607
. data ( repeat , keyFun ) ;
@@ -631,7 +634,8 @@ module.exports = function(root, svg, styledData, layout, callbacks) {
631
634
. call ( styleExtentTexts ) ;
632
635
633
636
axisExtentTopText
634
- . text ( function ( d ) { return formatExtreme ( d ) ( d . domainScale . domain ( ) . slice ( - 1 ) [ 0 ] ) ; } ) ;
637
+ . text ( function ( d ) { return formatExtreme ( d ) ( d . domainScale . domain ( ) . slice ( - 1 ) [ 0 ] ) ; } )
638
+ . each ( function ( d ) { Drawing . font ( axisExtentTopText , d . model . rangeFont ) ; } ) ;
635
639
636
640
var axisExtentBottom = axisExtent . selectAll ( '.axisExtentBottom' )
637
641
. data ( repeat , keyFun ) ;
@@ -653,7 +657,8 @@ module.exports = function(root, svg, styledData, layout, callbacks) {
653
657
. call ( styleExtentTexts ) ;
654
658
655
659
axisExtentBottomText
656
- . text ( function ( d ) { return formatExtreme ( d ) ( d . domainScale . domain ( ) [ 0 ] ) ; } ) ;
660
+ . text ( function ( d ) { return formatExtreme ( d ) ( d . domainScale . domain ( ) [ 0 ] ) ; } )
661
+ . each ( function ( d ) { Drawing . font ( axisExtentBottomText , d . model . rangeFont ) ; } ) ;
657
662
658
663
var axisBrush = axisOverlays . selectAll ( '.axisBrush' )
659
664
. data ( repeat , keyFun ) ;
0 commit comments