@@ -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
}
@@ -556,22 +561,18 @@ module.exports = function(root, svg, styledData, layout, callbacks) {
556
561
null )
557
562
. tickFormat ( d . ordinal ? function ( d ) { return d ; } : null )
558
563
. scale ( scale ) ) ;
564
+ Drawing . font ( axis . selectAll ( 'text' ) , d . model . tickFont ) ;
559
565
} ) ;
560
566
561
567
axis
562
- . selectAll ( '.domain, .tick' )
568
+ . selectAll ( '.domain, .tick>line ' )
563
569
. attr ( 'fill' , 'none' )
564
570
. attr ( 'stroke' , 'black' )
565
571
. attr ( 'stroke-opacity' , 0.25 )
566
572
. attr ( 'stroke-width' , '1px' ) ;
567
573
568
574
axis
569
575
. selectAll ( 'text' )
570
- . style ( 'font-weight' , 100 )
571
- . style ( 'font-size' , '10px' )
572
- . style ( 'fill' , 'black' )
573
- . style ( 'fill-opacity' , 1 )
574
- . style ( 'stroke' , 'none' )
575
576
. style ( 'text-shadow' , '1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff' )
576
577
. style ( 'cursor' , 'default' )
577
578
. style ( 'user-select' , 'none' ) ;
@@ -590,15 +591,14 @@ module.exports = function(root, svg, styledData, layout, callbacks) {
590
591
. append ( 'text' )
591
592
. classed ( 'axisTitle' , true )
592
593
. attr ( 'text-anchor' , 'middle' )
593
- . style ( 'font-family' , 'sans-serif' )
594
- . style ( 'font-size' , '10px' )
595
594
. style ( 'cursor' , 'ew-resize' )
596
595
. style ( 'user-select' , 'none' )
597
596
. style ( 'pointer-events' , 'auto' ) ;
598
597
599
598
axisTitle
600
599
. attr ( 'transform' , 'translate(0,' + - c . axisTitleOffset + ')' )
601
- . text ( function ( d ) { return d . label ; } ) ;
600
+ . text ( function ( d ) { return d . label ; } )
601
+ . each ( function ( d ) { Drawing . font ( axisTitle , d . model . labelFont ) ; } ) ;
602
602
603
603
var axisExtent = axisOverlays . selectAll ( '.axisExtent' )
604
604
. data ( repeat , keyFun ) ;
@@ -631,7 +631,8 @@ module.exports = function(root, svg, styledData, layout, callbacks) {
631
631
. call ( styleExtentTexts ) ;
632
632
633
633
axisExtentTopText
634
- . text ( function ( d ) { return formatExtreme ( d ) ( d . domainScale . domain ( ) . slice ( - 1 ) [ 0 ] ) ; } ) ;
634
+ . text ( function ( d ) { return formatExtreme ( d ) ( d . domainScale . domain ( ) . slice ( - 1 ) [ 0 ] ) ; } )
635
+ . each ( function ( d ) { Drawing . font ( axisExtentTopText , d . model . rangeFont ) ; } ) ;
635
636
636
637
var axisExtentBottom = axisExtent . selectAll ( '.axisExtentBottom' )
637
638
. data ( repeat , keyFun ) ;
@@ -653,7 +654,8 @@ module.exports = function(root, svg, styledData, layout, callbacks) {
653
654
. call ( styleExtentTexts ) ;
654
655
655
656
axisExtentBottomText
656
- . text ( function ( d ) { return formatExtreme ( d ) ( d . domainScale . domain ( ) [ 0 ] ) ; } ) ;
657
+ . text ( function ( d ) { return formatExtreme ( d ) ( d . domainScale . domain ( ) [ 0 ] ) ; } )
658
+ . each ( function ( d ) { Drawing . font ( axisExtentBottomText , d . model . rangeFont ) ; } ) ;
657
659
658
660
var axisBrush = axisOverlays . selectAll ( '.axisBrush' )
659
661
. data ( repeat , keyFun ) ;
0 commit comments