@@ -25,7 +25,7 @@ var constants = require('./constants');
25
25
var costConstants = constants . LABELOPTIMIZER ;
26
26
27
27
28
- module . exports = function plot ( gd , plotinfo , cdcontours ) {
28
+ exports . plot = function plot ( gd , plotinfo , cdcontours ) {
29
29
for ( var i = 0 ; i < cdcontours . length ; i ++ ) {
30
30
plotOne ( gd , plotinfo , cdcontours [ i ] ) ;
31
31
}
@@ -82,7 +82,7 @@ function plotOne(gd, plotinfo, cd) {
82
82
] ;
83
83
84
84
// draw everything
85
- var plotGroup = makeContourGroup ( plotinfo , cd , id ) ;
85
+ var plotGroup = exports . makeContourGroup ( plotinfo , cd , id ) ;
86
86
makeBackground ( plotGroup , perimeter , contours ) ;
87
87
makeFills ( plotGroup , pathinfo , perimeter , contours ) ;
88
88
makeLinesAndLabels ( plotGroup , pathinfo , gd , cd [ 0 ] , contours , perimeter ) ;
@@ -123,7 +123,7 @@ function emptyPathinfo(contours, plotinfo, cd0) {
123
123
}
124
124
return pathinfo ;
125
125
}
126
- function makeContourGroup ( plotinfo , cd , id ) {
126
+ exports . makeContourGroup = function ( plotinfo , cd , id ) {
127
127
var plotgroup = plotinfo . plot . select ( '.maplayer' )
128
128
. selectAll ( 'g.contour.' + id )
129
129
. data ( cd ) ;
@@ -135,7 +135,7 @@ function makeContourGroup(plotinfo, cd, id) {
135
135
plotgroup . exit ( ) . remove ( ) ;
136
136
137
137
return plotgroup ;
138
- }
138
+ } ;
139
139
140
140
function makeBackground ( plotgroup , perimeter , contours ) {
141
141
var bggroup = plotgroup . selectAll ( 'g.contourbg' ) . data ( [ 0 ] ) ;
@@ -278,7 +278,7 @@ function makeLinesAndLabels(plotgroup, pathinfo, gd, cd0, contours, perimeter) {
278
278
// if we're showing labels, because the fill paths include the perimeter
279
279
// so can't be used to position the labels correctly.
280
280
// In this case we'll remove the lines after making the labels.
281
- var linegroup = createLines ( lineContainer , showLines || showLabels , pathinfo ) ;
281
+ var linegroup = exports . createLines ( lineContainer , showLines || showLabels , pathinfo ) ;
282
282
283
283
var lineClip = createLineClip ( lineContainer , clipLinesForLabels ,
284
284
gd . _fullLayout . _defs , cd0 . trace . uid ) ;
@@ -358,7 +358,7 @@ function makeLinesAndLabels(plotgroup, pathinfo, gd, cd0, contours, perimeter) {
358
358
if ( showLabels && ! showLines ) linegroup . remove ( ) ;
359
359
}
360
360
361
- function createLines ( lineContainer , makeLines , pathinfo ) {
361
+ exports . createLines = function ( lineContainer , makeLines , pathinfo ) {
362
362
var smoothing = pathinfo [ 0 ] . smoothing ;
363
363
364
364
var linegroup = lineContainer . selectAll ( 'g.contourlevel' )
@@ -369,8 +369,10 @@ function createLines(lineContainer, makeLines, pathinfo) {
369
369
. classed ( 'contourlevel' , true ) ;
370
370
371
371
if ( makeLines ) {
372
+ // pedgepaths / ppaths are used by contourcarpet, for the paths transformed from a/b to x/y
373
+ // edgepaths / paths are used by contour since it's in x/y from the start
372
374
var opencontourlines = linegroup . selectAll ( 'path.openline' )
373
- . data ( function ( d ) { return d . edgepaths ; } ) ;
375
+ . data ( function ( d ) { return d . pedgepaths || d . edgepaths ; } ) ;
374
376
375
377
opencontourlines . exit ( ) . remove ( ) ;
376
378
opencontourlines . enter ( ) . append ( 'path' )
@@ -384,7 +386,7 @@ function createLines(lineContainer, makeLines, pathinfo) {
384
386
. style ( 'vector-effect' , 'non-scaling-stroke' ) ;
385
387
386
388
var closedcontourlines = linegroup . selectAll ( 'path.closedline' )
387
- . data ( function ( d ) { return d . paths ; } ) ;
389
+ . data ( function ( d ) { return d . ppaths || d . paths ; } ) ;
388
390
389
391
closedcontourlines . exit ( ) . remove ( ) ;
390
392
closedcontourlines . enter ( ) . append ( 'path' )
@@ -399,7 +401,7 @@ function createLines(lineContainer, makeLines, pathinfo) {
399
401
}
400
402
401
403
return linegroup ;
402
- }
404
+ } ;
403
405
404
406
function createLineClip ( lineContainer , clipLinesForLabels , defs , uid ) {
405
407
var clipId = clipLinesForLabels ? ( 'clipline' + uid ) : null ;
0 commit comments