Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions devtools/test_dashboard/buttons.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* global Plotly:false Tabs:false */

var Lib = require('@src/lib');

var plotlist = document.getElementById('plot-list');
var anchor = document.getElementById('embedded-graph');
var image = document.getElementById('embedded-image');
Expand Down Expand Up @@ -40,9 +42,10 @@ function plotButtons(plots, figDir) {
anchor.appendChild(gd);

var plot = plots[plotname];
Plotly.plot(gd, plot.data, plot.layout);

var data = Lib.extendDeep([], plot.data);
var layout = Lib.extendDeep({}, plot.layout);

Plotly.plot(gd, data, layout);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

persisting legendonly from click to click no more.

});
});

Expand Down
11 changes: 9 additions & 2 deletions devtools/test_dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

<!-- helper functions to manipulate the graph div -->
<script>
var d3 = Plotly.d3;

var Tabs = {
getGraph: function() {
return document.getElementById('embedded-graph').children[0];
Expand All @@ -34,10 +36,15 @@
anchor.appendChild(graphDiv);

return graphDiv;
},
plotMock: function(mockName) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g.

Tabs.plotMock('20'); 

to plot ./test/image/mocks/20.json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

var mockURL = '../../test/image/mocks/' + mockName + '.json';

d3.json(mockURL, function(err, fig) {
Plotly.plot(Tabs.fresh(), fig.data, fig.layout);
});
}
};

var d3 = Plotly.d3;
</script>

</body>
Expand Down