Skip to content

Commit 0c3b14b

Browse files
committed
Merge pull request #263 from plotly/dashboard-improvements
Dashboard improvements
2 parents b11c365 + c1a22fb commit 0c3b14b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

devtools/test_dashboard/buttons.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* global Plotly:false Tabs:false */
22

3+
var Lib = require('@src/lib');
4+
35
var plotlist = document.getElementById('plot-list');
46
var anchor = document.getElementById('embedded-graph');
57
var image = document.getElementById('embedded-image');
@@ -40,9 +42,10 @@ function plotButtons(plots, figDir) {
4042
anchor.appendChild(gd);
4143

4244
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);
4547

48+
Plotly.plot(gd, data, layout);
4649
});
4750
});
4851

devtools/test_dashboard/index.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
<!-- helper functions to manipulate the graph div -->
2323
<script>
24+
var d3 = Plotly.d3;
25+
2426
var Tabs = {
2527
getGraph: function() {
2628
return document.getElementById('embedded-graph').children[0];
@@ -34,10 +36,15 @@
3436
anchor.appendChild(graphDiv);
3537

3638
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+
});
3746
}
3847
};
39-
40-
var d3 = Plotly.d3;
4148
</script>
4249

4350
</body>

0 commit comments

Comments
 (0)