File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 1
1
/* global Plotly:false Tabs:false */
2
2
3
+ var Lib = require ( '@src/lib' ) ;
4
+
3
5
var plotlist = document . getElementById ( 'plot-list' ) ;
4
6
var anchor = document . getElementById ( 'embedded-graph' ) ;
5
7
var image = document . getElementById ( 'embedded-image' ) ;
@@ -40,9 +42,10 @@ function plotButtons(plots, figDir) {
40
42
anchor . appendChild ( gd ) ;
41
43
42
44
var plot = plots [ plotname ] ;
43
- Plotly . plot ( gd , plot . data , plot . layout ) ;
44
-
45
+ var data = Lib . extendDeep ( [ ] , plot . data ) ;
46
+ var layout = Lib . extendDeep ( { } , plot . layout ) ;
45
47
48
+ Plotly . plot ( gd , data , layout ) ;
46
49
} ) ;
47
50
} ) ;
48
51
Original file line number Diff line number Diff line change 21
21
22
22
<!-- helper functions to manipulate the graph div -->
23
23
< script >
24
+ var d3 = Plotly . d3 ;
25
+
24
26
var Tabs = {
25
27
getGraph : function ( ) {
26
28
return document . getElementById ( 'embedded-graph' ) . children [ 0 ] ;
34
36
anchor . appendChild ( graphDiv ) ;
35
37
36
38
return graphDiv ;
39
+ } ,
40
+ plotMock : function ( mockName ) {
41
+ var mockURL = '../../test/image/mocks/' + mockName + '.json' ;
42
+
43
+ d3 . json ( mockURL , function ( err , fig ) {
44
+ Plotly . plot ( Tabs . fresh ( ) , fig . data , fig . layout ) ;
45
+ } ) ;
37
46
}
38
47
} ;
39
-
40
- var d3 = Plotly . d3 ;
41
48
</ script >
42
49
43
50
</ body >
You can’t perform that action at this time.
0 commit comments