@@ -14,6 +14,8 @@ var d3 = require('d3');
14
14
var Lib = require ( '../../lib' ) ;
15
15
var Drawing = require ( '../../components/drawing' ) ;
16
16
var svgTextUtils = require ( '../../lib/svg_text_utils' ) ;
17
+ var Axes = require ( '../../plots/cartesian/axes' ) ;
18
+ var setConvert = require ( '../../plots/cartesian/set_convert' ) ;
17
19
18
20
var heatmapPlot = require ( '../heatmap/plot' ) ;
19
21
var makeCrossings = require ( './make_crossings' ) ;
@@ -345,18 +347,27 @@ function makeLinesAndLabels(plotgroup, pathinfo, gd, cd0, contours, perimeter) {
345
347
contourFormat = d3 . format ( contours . labelformat ) ;
346
348
}
347
349
else {
348
- // round to 2 digits past magnitude of contours.size,
349
- // then remove trailing zeroes
350
- var valRound = 2 - Math . floor ( Math . log ( contours . size ) / Math . LN10 + 0.01 ) ;
351
- if ( valRound <= 0 ) {
352
- contourFormat = function ( v ) { return v . toFixed ( ) ; } ;
350
+ var formatAxis ;
351
+ if ( cd0 . t . cb ) {
352
+ formatAxis = cd0 . t . cb . axis ;
353
353
}
354
354
else {
355
- contourFormat = function ( v ) {
356
- var valStr = v . toFixed ( valRound ) ;
357
- return valStr . replace ( TRAILING_ZEROS , '' ) ;
355
+ formatAxis = {
356
+ type : 'linear' ,
357
+ _separators : '.,' ,
358
+ _id : 'ycontour' ,
359
+ nticks : pathinfo . length ,
360
+ showexponent : 'all' ,
361
+ range : [ contours . start , contours . end ]
358
362
} ;
363
+ setConvert ( formatAxis , gd . _fullLayout ) ;
364
+ Axes . calcTicks ( formatAxis ) ;
365
+ formatAxis . _tmin = null ;
366
+ formatAxis . _tmax = null ;
359
367
}
368
+ contourFormat = function ( v ) {
369
+ return Axes . tickText ( formatAxis , v ) . text ;
370
+ } ;
360
371
}
361
372
362
373
var dummyText = defs . append ( 'text' )
0 commit comments