File tree Expand file tree Collapse file tree 2 files changed +53
-5
lines changed Expand file tree Collapse file tree 2 files changed +53
-5
lines changed Original file line number Diff line number Diff line change @@ -113,14 +113,26 @@ module.exports = function clonePlot(graphObj, options) {
113
113
} ;
114
114
}
115
115
for ( i = 0 ; i < sceneIds . length ; i ++ ) {
116
- var sceneId = sceneIds [ i ] ;
116
+ var scene = newLayout [ sceneIds [ i ] ] ;
117
117
118
- extendFlat ( newLayout [ sceneId ] . xaxis , axesImageOverride ) ;
119
- extendFlat ( newLayout [ sceneId ] . yaxis , axesImageOverride ) ;
120
- extendFlat ( newLayout [ sceneId ] . zaxis , axesImageOverride ) ;
118
+ if ( ! scene . xaxis ) {
119
+ scene . xaxis = { } ;
120
+ }
121
+
122
+ if ( ! scene . yaxis ) {
123
+ scene . yaxis = { } ;
124
+ }
125
+
126
+ if ( ! scene . zaxis ) {
127
+ scene . zaxis = { } ;
128
+ }
129
+
130
+ extendFlat ( scene . xaxis , axesImageOverride ) ;
131
+ extendFlat ( scene . yaxis , axesImageOverride ) ;
132
+ extendFlat ( scene . zaxis , axesImageOverride ) ;
121
133
122
134
// TODO what does this do?
123
- newLayout [ sceneId ] . _scene = null ;
135
+ scene . _scene = null ;
124
136
}
125
137
}
126
138
Original file line number Diff line number Diff line change @@ -116,6 +116,42 @@ describe('Plotly.Snapshot', function() {
116
116
expect ( thumbTile . layout . annotations ) . toEqual ( THUMBNAIL_DEFAULT_LAYOUT . annotations ) ;
117
117
} ) ;
118
118
119
+ it ( 'should create a 3D thumbnail with limited attributes' , function ( ) {
120
+
121
+ var figure = {
122
+ data : [ {
123
+ type : 'scatter' ,
124
+ mode : 'markers' ,
125
+ y : [ 2 , 4 , 6 , 5 , 7 , 4 ] ,
126
+ x : [ 1 , 3 , 4 , 6 , 3 , 1 ] ,
127
+ name : 'C'
128
+ } ] ,
129
+ layout : {
130
+ autosize : true ,
131
+ scene : {
132
+ aspectratio : { y : 1 , x : 1 , z : 1 }
133
+ }
134
+ } } ;
135
+
136
+
137
+ var thumbnailOptions = {
138
+ tileClass : 'thumbnail'
139
+ } ;
140
+
141
+ var AXIS_OVERRIDE = {
142
+ title : '' ,
143
+ showaxeslabels : false ,
144
+ showticklabels : false ,
145
+ linetickenable : false
146
+ } ;
147
+
148
+ var thumbTile = Plotly . Snapshot . clone ( figure , thumbnailOptions ) ;
149
+ expect ( thumbTile . layout . scene . xaxis ) . toEqual ( AXIS_OVERRIDE ) ;
150
+ expect ( thumbTile . layout . scene . yaxis ) . toEqual ( AXIS_OVERRIDE ) ;
151
+ expect ( thumbTile . layout . scene . zaxis ) . toEqual ( AXIS_OVERRIDE ) ;
152
+ } ) ;
153
+
154
+
119
155
it ( 'should create a custom sized Tile based on options' , function ( ) {
120
156
var customOptions = {
121
157
tileClass : 'notarealclass' ,
You can’t perform that action at this time.
0 commit comments