9
9
10
10
'use strict' ;
11
11
12
- var Plots = require ( '../../plots/plots' ) ;
13
12
var Axes = require ( '../../plots/cartesian/axes' ) ;
14
13
var Fx = require ( '../../plots/cartesian/graph_interact' ) ;
15
14
@@ -19,7 +18,6 @@ var createSelectBox = require('gl-select-box');
19
18
20
19
var createOptions = require ( './convert' ) ;
21
20
var createCamera = require ( './camera' ) ;
22
-
23
21
var htmlToUnicode = require ( '../../lib/html2unicode' ) ;
24
22
var showNoWebGlMsg = require ( '../../lib/show_no_webgl_msg' ) ;
25
23
@@ -301,11 +299,11 @@ proto.destroy = function() {
301
299
this . stopped = true ;
302
300
} ;
303
301
304
- proto . plot = function ( fullData , fullLayout ) {
302
+ proto . plot = function ( fullData , calcData , fullLayout ) {
305
303
var glplot = this . glplot ,
306
304
pixelRatio = this . pixelRatio ;
307
305
308
- var i , j ;
306
+ var i , j , trace ;
309
307
310
308
this . fullLayout = fullLayout ;
311
309
this . updateAxes ( fullLayout ) ;
@@ -322,30 +320,27 @@ proto.plot = function(fullData, fullLayout) {
322
320
canvas . height = pixelHeight ;
323
321
}
324
322
325
- if ( ! fullData ) fullData = [ ] ;
326
- else if ( ! Array . isArray ( fullData ) ) fullData = [ fullData ] ;
327
-
328
323
// update traces
329
- var traceData , trace ;
330
324
for ( i = 0 ; i < fullData . length ; ++ i ) {
331
- traceData = fullData [ i ] ;
332
- trace = this . traces [ traceData . uid ] ;
325
+ var fullTrace = fullData [ i ] ,
326
+ calcTrace = calcData [ i ] ;
327
+ trace = this . traces [ fullTrace . uid ] ;
333
328
334
- if ( trace ) trace . update ( traceData ) ;
329
+ if ( trace ) trace . update ( fullTrace , calcTrace ) ;
335
330
else {
336
- var traceModule = Plots . getModule ( traceData . type ) ;
337
- trace = traceModule . plot ( this , traceData ) ;
331
+ trace = fullTrace . _module . plot ( this , fullTrace , calcTrace ) ;
338
332
}
339
- this . traces [ traceData . uid ] = trace ;
333
+
334
+ this . traces [ fullTrace . uid ] = trace ;
340
335
}
341
336
342
337
// remove empty traces
343
338
var traceIds = Object . keys ( this . traces ) ;
344
339
345
340
trace_id_loop:
346
341
for ( i = 0 ; i < traceIds . length ; ++ i ) {
347
- for ( j = 0 ; j < fullData . length ; ++ j ) {
348
- if ( fullData [ j ] . uid === traceIds [ i ] ) continue trace_id_loop;
342
+ for ( j = 0 ; j < calcData . length ; ++ j ) {
343
+ if ( calcData [ j ] [ 0 ] . trace . uid === traceIds [ i ] ) continue trace_id_loop;
349
344
}
350
345
351
346
trace = this . traces [ traceIds [ i ] ] ;
@@ -480,6 +475,7 @@ proto.draw = function() {
480
475
var parts = hoverinfo . split ( '+' ) ;
481
476
if ( parts . indexOf ( 'x' ) === - 1 ) selection . traceCoord [ 0 ] = undefined ;
482
477
if ( parts . indexOf ( 'y' ) === - 1 ) selection . traceCoord [ 1 ] = undefined ;
478
+ if ( parts . indexOf ( 'z' ) === - 1 ) selection . traceCoord [ 2 ] = undefined ;
483
479
if ( parts . indexOf ( 'text' ) === - 1 ) selection . textLabel = undefined ;
484
480
if ( parts . indexOf ( 'name' ) === - 1 ) selection . name = undefined ;
485
481
}
@@ -489,6 +485,7 @@ proto.draw = function() {
489
485
y : selection . screenCoord [ 1 ] ,
490
486
xLabel : this . hoverFormatter ( 'xaxis' , selection . traceCoord [ 0 ] ) ,
491
487
yLabel : this . hoverFormatter ( 'yaxis' , selection . traceCoord [ 1 ] ) ,
488
+ zLabel : selection . traceCoord [ 2 ] ,
492
489
text : selection . textLabel ,
493
490
name : selection . name ,
494
491
color : selection . color
0 commit comments