Skip to content

Commit c1a22fb

Browse files
committed
add Tabs.plotMock,
- quick helper to plot a given mock json in ./test/image/mocks/
1 parent 621fbd3 commit c1a22fb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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)