2
2
3
3
var Lib = require ( '@src/lib' ) ;
4
4
5
- var plotlist = document . getElementById ( 'plot-list' ) ;
5
+ var plotList = document . getElementById ( 'plot-list' ) ;
6
6
var anchor = document . getElementById ( 'embedded-graph' ) ;
7
7
var image = document . getElementById ( 'embedded-image' ) ;
8
8
@@ -14,31 +14,30 @@ anchor.style.height = '600px';
14
14
anchor . style . width = '1000px' ;
15
15
16
16
function plotButtons ( plots , figDir ) {
17
-
18
17
Object . keys ( plots ) . forEach ( function ( plotname ) {
19
-
20
18
var button = document . createElement ( 'button' ) ;
21
19
22
20
button . style . cssFloat = 'left' ;
23
21
button . style . width = '100px' ;
24
22
button . style . height = '40px' ;
25
-
26
23
button . innerHTML = plotname ;
27
24
28
- plotlist . appendChild ( button ) ;
25
+ plotList . appendChild ( button ) ;
29
26
30
27
button . addEventListener ( 'click' , function ( ) {
31
-
32
28
var myImage = new Image ( ) ;
33
29
myImage . src = figDir + plotname + '.png' ;
34
30
35
31
image . innerHTML = '' ;
36
32
image . appendChild ( myImage ) ;
37
33
38
-
39
- anchor . innerHTML = '' ;
34
+ var currentGraphDiv = Tabs . getGraph ( ) ;
35
+ if ( currentGraphDiv ) Plotly . purge ( currentGraphDiv ) ;
40
36
41
37
gd = document . createElement ( 'div' ) ;
38
+ gd . id = 'graph' ;
39
+
40
+ anchor . innerHTML = '' ;
42
41
anchor . appendChild ( gd ) ;
43
42
44
43
var plot = plots [ plotname ] ;
@@ -58,7 +57,7 @@ function plotButtons(plots, figDir) {
58
57
snapshot . innerHTML = 'snapshot' ;
59
58
snapshot . style . background = 'blue' ;
60
59
61
- plotlist . appendChild ( snapshot ) ;
60
+ plotList . appendChild ( snapshot ) ;
62
61
63
62
snapshot . addEventListener ( 'click' , function ( ) {
64
63
@@ -111,7 +110,7 @@ function plotButtons(plots, figDir) {
111
110
pummelButton . style . marginLeft = '25px' ;
112
111
pummelButton . innerHTML = 'pummel3d' ;
113
112
pummelButton . style . background = 'blue' ;
114
- plotlist . appendChild ( pummelButton ) ;
113
+ plotList . appendChild ( pummelButton ) ;
115
114
116
115
var i = 0 ;
117
116
var mock = require ( '@mocks/gl3d_marker-color.json' ) ;
@@ -147,7 +146,7 @@ function plotButtons(plots, figDir) {
147
146
scrapeButton . style . marginLeft = '25px' ;
148
147
scrapeButton . innerHTML = 'scrape SVG' ;
149
148
scrapeButton . style . background = 'blue' ;
150
- plotlist . appendChild ( scrapeButton ) ;
149
+ plotList . appendChild ( scrapeButton ) ;
151
150
152
151
scrapeButton . addEventListener ( 'click' , function ( ) {
153
152
Plotly . Snapshot . toSVG ( Tabs . get ( ) ) ;
0 commit comments