99
1010'use strict' ;
1111
12- var Plots = require ( '../../plots/plots' ) ;
1312var Axes = require ( '../../plots/cartesian/axes' ) ;
1413var Fx = require ( '../../plots/cartesian/graph_interact' ) ;
1514
@@ -19,7 +18,6 @@ var createSelectBox = require('gl-select-box');
1918
2019var createOptions = require ( './convert' ) ;
2120var createCamera = require ( './camera' ) ;
22-
2321var htmlToUnicode = require ( '../../lib/html2unicode' ) ;
2422var showNoWebGlMsg = require ( '../../lib/show_no_webgl_msg' ) ;
2523
@@ -301,11 +299,11 @@ proto.destroy = function() {
301299 this . stopped = true ;
302300} ;
303301
304- proto . plot = function ( fullData , fullLayout ) {
302+ proto . plot = function ( fullData , calcData , fullLayout ) {
305303 var glplot = this . glplot ,
306304 pixelRatio = this . pixelRatio ;
307305
308- var i , j ;
306+ var i , j , trace ;
309307
310308 this . fullLayout = fullLayout ;
311309 this . updateAxes ( fullLayout ) ;
@@ -322,30 +320,27 @@ proto.plot = function(fullData, fullLayout) {
322320 canvas . height = pixelHeight ;
323321 }
324322
325- if ( ! fullData ) fullData = [ ] ;
326- else if ( ! Array . isArray ( fullData ) ) fullData = [ fullData ] ;
327-
328323 // update traces
329- var traceData , trace ;
330324 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 ] ;
333328
334- if ( trace ) trace . update ( traceData ) ;
329+ if ( trace ) trace . update ( fullTrace , calcTrace ) ;
335330 else {
336- var traceModule = Plots . getModule ( traceData . type ) ;
337- trace = traceModule . plot ( this , traceData ) ;
331+ trace = fullTrace . _module . plot ( this , fullTrace , calcTrace ) ;
338332 }
339- this . traces [ traceData . uid ] = trace ;
333+
334+ this . traces [ fullTrace . uid ] = trace ;
340335 }
341336
342337 // remove empty traces
343338 var traceIds = Object . keys ( this . traces ) ;
344339
345340 trace_id_loop:
346341 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;
349344 }
350345
351346 trace = this . traces [ traceIds [ i ] ] ;
@@ -480,6 +475,7 @@ proto.draw = function() {
480475 var parts = hoverinfo . split ( '+' ) ;
481476 if ( parts . indexOf ( 'x' ) === - 1 ) selection . traceCoord [ 0 ] = undefined ;
482477 if ( parts . indexOf ( 'y' ) === - 1 ) selection . traceCoord [ 1 ] = undefined ;
478+ if ( parts . indexOf ( 'z' ) === - 1 ) selection . traceCoord [ 2 ] = undefined ;
483479 if ( parts . indexOf ( 'text' ) === - 1 ) selection . textLabel = undefined ;
484480 if ( parts . indexOf ( 'name' ) === - 1 ) selection . name = undefined ;
485481 }
@@ -489,6 +485,7 @@ proto.draw = function() {
489485 y : selection . screenCoord [ 1 ] ,
490486 xLabel : this . hoverFormatter ( 'xaxis' , selection . traceCoord [ 0 ] ) ,
491487 yLabel : this . hoverFormatter ( 'yaxis' , selection . traceCoord [ 1 ] ) ,
488+ zLabel : selection . traceCoord [ 2 ] ,
492489 text : selection . textLabel ,
493490 name : selection . name ,
494491 color : selection . color
0 commit comments