99
1010'use strict' ;
1111
12- var Plotly = require ( '../../plotly' ) ;
12+ var Plots = require ( '../../plots/plots' ) ;
13+ var Axes = require ( '../../plots/cartesian/axes' ) ;
14+ var Fx = require ( '../../plots/cartesian/graph_interact' ) ;
15+
1316var createPlot2D = require ( 'gl-plot2d' ) ;
1417var createSpikes = require ( 'gl-spikes2d' ) ;
1518var createSelectBox = require ( 'gl-select-box' ) ;
1619
1720var createOptions = require ( './convert' ) ;
1821var createCamera = require ( './camera' ) ;
1922
20- var createLineWithMarkers = require ( '../../traces/scattergl/convert' ) ;
21-
2223var htmlToUnicode = require ( '../../lib/html2unicode' ) ;
2324var showNoWebGlMsg = require ( '../../lib/show_no_webgl_msg' ) ;
2425
@@ -223,8 +224,8 @@ proto.computeTickMarks = function() {
223224 this . glplot . viewBox [ 3 ] - this . glplot . viewBox [ 1 ] ;
224225
225226 var nextTicks = [
226- Plotly . Axes . calcTicks ( this . xaxis ) ,
227- Plotly . Axes . calcTicks ( this . yaxis )
227+ Axes . calcTicks ( this . xaxis ) ,
228+ Axes . calcTicks ( this . yaxis )
228229 ] ;
229230
230231 for ( var j = 0 ; j < 2 ; ++ j ) {
@@ -254,7 +255,7 @@ function compareTicks(a, b) {
254255}
255256
256257proto . updateAxes = function ( options ) {
257- var spmatch = Plotly . Axes . subplotMatch ,
258+ var spmatch = Axes . subplotMatch ,
258259 xaxisName = 'xaxis' + this . id . match ( spmatch ) [ 1 ] ,
259260 yaxisName = 'yaxis' + this . id . match ( spmatch ) [ 2 ] ;
260261
@@ -325,11 +326,8 @@ proto.plot = function(fullData, fullLayout) {
325326
326327 if ( trace ) trace . update ( traceData ) ;
327328 else {
328- switch ( traceData . type ) {
329- case 'scattergl' :
330- trace = createLineWithMarkers ( this , traceData ) ;
331- break ;
332- }
329+ var traceModule = Plots . getModule ( traceData . type ) ;
330+ trace = traceModule . plot ( this , traceData ) ;
333331 }
334332 this . traces [ traceData . uid ] = trace ;
335333 }
@@ -392,7 +390,7 @@ proto.plot = function(fullData, fullLayout) {
392390 ax = this [ AXES [ i ] ] ;
393391 ax . _length = options . viewBox [ i + 2 ] - options . viewBox [ i ] ;
394392
395- Plotly . Axes . doAutoRange ( ax ) ;
393+ Axes . doAutoRange ( ax ) ;
396394 }
397395
398396 options . ticks = this . computeTickMarks ( ) ;
@@ -475,7 +473,7 @@ proto.draw = function() {
475473 if ( parts . indexOf ( 'name' ) === - 1 ) selection . name = undefined ;
476474 }
477475
478- Plotly . Fx . loneHover ( {
476+ Fx . loneHover ( {
479477 x : selection . screenCoord [ 0 ] ,
480478 y : selection . screenCoord [ 1 ] ,
481479 xLabel : this . hoverFormatter ( 'xaxis' , selection . traceCoord [ 0 ] ) ,
@@ -493,7 +491,7 @@ proto.draw = function() {
493491 else if ( ! result && this . lastPickResult ) {
494492 this . spikes . update ( { } ) ;
495493 this . lastPickResult = null ;
496- Plotly . Fx . loneUnhover ( this . svgContainer ) ;
494+ Fx . loneUnhover ( this . svgContainer ) ;
497495 }
498496 }
499497
@@ -504,5 +502,5 @@ proto.hoverFormatter = function(axisName, val) {
504502 if ( val === undefined ) return undefined ;
505503
506504 var axis = this [ axisName ] ;
507- return Plotly . Axes . tickText ( axis , axis . c2l ( val ) , 'hover' ) . text ;
505+ return Axes . tickText ( axis , axis . c2l ( val ) , 'hover' ) . text ;
508506} ;
0 commit comments