Skip to content
Open
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
31 changes: 31 additions & 0 deletions src/visualizers/widgets/PlotlyGraph/PlotlyGraphWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,37 @@ define([
json.layout.plot_bgcolor = PLOT_BG_COLOR;
json.layout.paper_bgcolor = PLOT_BG_COLOR;

const icon1 = {
'width': 500,
'height': 600,
'path': 'M224 512c35.32 0 63.97-28.65 63.97-64H160.03c0 35.35 28.65 64 63.97 64zm215.39-149.71c-19.32-20.76-55.47-51.99-55.47-154.29 0-77.7-54.48-139.9-127.94-155.16V32c0-17.67-14.32-32-31.98-32s-31.98 14.33-31.98 32v20.84C118.56 68.1 64.08 130.3 64.08 208c0 102.3-36.15 133.53-55.47 154.29-6 6.45-8.66 14.16-8.61 21.71.11 16.4 12.98 32 32.1 32h383.8c19.12 0 32-15.6 32.1-32 .05-7.55-2.61-15.27-8.61-21.71z'
};
json.config = {
modeBarButtonsToAdd: [
{
name: 'save camera',
icon: icon1,
click: function(gd) {
var scene = gd._fullLayout.scene._scene;
const layout = {};
scene.saveLayout(layout);
localStorage['camera'] = JSON.stringify(layout.scene);
}
},
{
name: 'reset camera',
icon: icon1,
click: function(gd) {
var scene = gd._fullLayout.scene._scene;
if (localStorage['camera']) {
const cameraView = JSON.parse(localStorage['camera']);
scene.setViewport(cameraView);
}
}
}
],
modeBarButtonsToRemove: ['pan2d','select2d','lasso2d','resetScale2d','zoomOut2d']
};
Plotly.newPlot(plotlyDiv[0], json);
this.plots.push(plotlyDiv);
this.$el.append(plotlyDiv);
Expand Down