Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Plotly #4752

Merged
merged 5 commits into from
Apr 6, 2020
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
1 change: 1 addition & 0 deletions client/app/visualizations/chart/plotly/applyLayoutFixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default function applyLayoutFixes(plotlyElement, layout, updatePlot) {
// half of plot container's height - legend will have max height equal to
// plot height), re-render plot again and offset legend to the space under
// the plot.
// Related issue: https://github.com/plotly/plotly.js/issues/1199
layout.legend = {
orientation: "h",
// locate legend inside of plot area - otherwise plotly will preserve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
},
"output": {
"layout": {
"margin": { "l": 10, "r": 10, "b": 10, "t": 25, "pad": 4 },
"margin": { "l": 10, "r": 10, "b": 5, "t": 20, "pad": 4 },
"width": 400,
"height": 300,
"autosize": true,
"autosize": false,
"showlegend": true,
"boxmode": "group",
"boxgroupgap": 0.50,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
},
"output": {
"layout": {
"margin": { "l": 10, "r": 10, "b": 10, "t": 25, "pad": 4 },
"margin": { "l": 10, "r": 10, "b": 5, "t": 20, "pad": 4 },
"width": 400,
"height": 300,
"autosize": true,
"autosize": false,
"showlegend": true,
"boxmode": "group",
"boxgroupgap": 0.50,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
},
"output": {
"layout": {
"margin": { "l": 10, "r": 10, "b": 10, "t": 25, "pad": 4 },
"margin": { "l": 10, "r": 10, "b": 5, "t": 20, "pad": 4 },
"width": 400,
"height": 300,
"autosize": true,
"autosize": false,
"showlegend": true,
"xaxis": {
"automargin": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
},
"output": {
"layout": {
"margin": { "l": 10, "r": 10, "b": 10, "t": 25, "pad": 4 },
"margin": { "l": 10, "r": 10, "b": 5, "t": 20, "pad": 4 },
"width": 400,
"height": 300,
"autosize": true,
"autosize": false,
"showlegend": true,
"xaxis": {
"automargin": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
},
"output": {
"layout": {
"margin": { "l": 10, "r": 10, "b": 10, "t": 25, "pad": 4 },
"margin": { "l": 10, "r": 10, "b": 5, "t": 20, "pad": 4 },
"width": 400,
"height": 300,
"autosize": true,
"autosize": false,
"showlegend": false,
"barmode": "relative",
"xaxis": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
},
"output": {
"layout": {
"margin": { "l": 10, "r": 10, "b": 10, "t": 25, "pad": 4 },
"margin": { "l": 10, "r": 10, "b": 5, "t": 20, "pad": 4 },
"width": 400,
"height": 300,
"autosize": true,
"autosize": false,
"showlegend": false,
"xaxis": {
"automargin": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
},
"output": {
"layout": {
"margin": { "l": 10, "r": 10, "b": 10, "t": 25, "pad": 4 },
"margin": { "l": 10, "r": 10, "b": 5, "t": 20, "pad": 4 },
"width": 400,
"height": 300,
"autosize": true,
"autosize": false,
"showlegend": true,
"annotations": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
},
"output": {
"layout": {
"margin": { "l": 10, "r": 10, "b": 10, "t": 25, "pad": 4 },
"margin": { "l": 10, "r": 10, "b": 5, "t": 20, "pad": 4 },
"width": 400,
"height": 300,
"autosize": true,
"autosize": false,
"showlegend": true,
"annotations": []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
},
"output": {
"layout": {
"margin": { "l": 10, "r": 10, "b": 10, "t": 25, "pad": 4 },
"margin": { "l": 10, "r": 10, "b": 5, "t": 20, "pad": 4 },
"width": 400,
"height": 300,
"autosize": true,
"autosize": false,
"showlegend": true,
"annotations": [
{
Expand Down
4 changes: 2 additions & 2 deletions client/app/visualizations/chart/plotly/prepareLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ function prepareBoxLayout(layout, options, data) {

export default function prepareLayout(element, options, data) {
const layout = {
margin: { l: 10, r: 10, b: 10, t: 25, pad: 4 },
margin: { l: 10, r: 10, b: 5, t: 20, pad: 4 },
Copy link
Member

Choose a reason for hiding this comment

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

Without this change there are just bigger margins?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, and for me it looked too large; left/right paddings also changed a little bit, but in all cases it depends on axis labels (seems Plotly changed an algorithm that measures labels and now it preserves few more pixels for labels). Also seems that extra space also depends on chart size, therefore I was unable to fit margins perfectly, just as close as possible

width: Math.floor(element.offsetWidth),
height: Math.floor(element.offsetHeight),
autosize: true,
autosize: false,
Copy link
Member

Choose a reason for hiding this comment

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

What do we lose by disabling autosize?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Built-in autosize feature is based on window.onresize, and since we have implemented this feature on our own (via resizeObserver service which is even more powerful) - we don't really need it. So turned it off just to save some resources.

showlegend: has(options, "legend") ? options.legend.enabled : true,
};

Expand Down
Loading