Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Drop support for deprecated error bar opacity attribute (use alpha channel of error bar color attribute instead) #7216

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

Merged
merged 8 commits into from
Oct 8, 2024
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 1 draftlogs/7216_remove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop support for deprecated error bar `opacity` attribute (use alpha channel of error bar `color` attribute instead) [[#7214](https://github.com/plotly/plotly.js/pull/7216)]
13 changes: 1 addition & 12 deletions 13 src/components/errorbars/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module.exports = {
color: {
valType: 'color',
editType: 'style',
description: 'Sets the stoke color of the error bars.'
description: 'Sets the stroke color of the error bars.'
},
thickness: {
valType: 'number',
Expand All @@ -121,15 +121,4 @@ module.exports = {
].join(' ')
},
editType: 'calc',

_deprecated: {
opacity: {
valType: 'number',
editType: 'style',
description: [
'Obsolete.',
'Use the alpha channel in error bar `color` to set the opacity.'
].join(' ')
}
}
};
12 changes: 0 additions & 12 deletions 12 src/plot_api/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,6 @@ exports.cleanData = function(data) {
delete trace.xbins;
}

// error_y.opacity is obsolete - merge into color
if(trace.error_y && 'opacity' in trace.error_y) {
var dc = Color.defaults;
var yeColor = trace.error_y.color || (traceIs(trace, 'bar') ?
Color.defaultLine :
dc[tracei % dc.length]);
trace.error_y.color = Color.addOpacity(
Color.rgb(yeColor),
Color.opacity(yeColor) * trace.error_y.opacity);
delete trace.error_y.opacity;
}

// now we have only one 1D histogram type, and whether
// it uses x or y data depends on trace.orientation
if(trace.type === 'histogramy') exports.swapXYData(trace);
Expand Down
Binary file modified BIN +415 Bytes (100%) test/image/baselines/error_bar_style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions 10 test/image/mocks/error_bar_style.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,16 @@
"error_y": {
"type": "constant",
"value": 0.1,
"color": "#85144B",
"color": "#85144BCC",
"thickness": 1.5,
"width": 3,
"opacity": 1
Copy link
Contributor

Choose a reason for hiding this comment

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

just for my own learning, what happened to "opacity"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

opacity can also be specified by using the alpha channel of the color attribute, which defaults to full-opacity, so the same image result can be achieved without explicitly setting the opacity.

I guess for the purposes of this test it might make sense to include it explicitly though.

Copy link
Contributor

Choose a reason for hiding this comment

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

very happy to use color instead (fewer parameters is better) - was just wondering how we were now handling it - thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know why we chose to deprecate opacity here though and not elsewhere, maybe @archmoj has an idea

Copy link
Collaborator

Choose a reason for hiding this comment

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

In some places - particularly where multiple colors or multiple objects are involved - there are many different effects you can achieve depending on exactly where you set the opacity

Screenshot 2024-10-08 at 10 15 34

Here though I guess there's nothing you can't achieve just with the opacity of the color.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes perfect sense -- thanks @alexcjohnson .

"width": 3
},
"error_x": {
"type": "constant",
"value": 0.2,
"color": "#85144B",
"color": "#85144B44",
"thickness": 1.5,
"width": 3,
"opacity": 1
"width": 3
},
"marker": {
"color": "#85144B",
Expand Down
99 changes: 11 additions & 88 deletions 99 test/plot-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -17345,13 +17345,6 @@
"valType": "number"
},
"error_x": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "style",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -17373,7 +17366,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "style",
"valType": "color"
},
Expand Down Expand Up @@ -17445,13 +17438,6 @@
}
},
"error_y": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "style",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -17473,7 +17459,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "style",
"valType": "color"
},
Expand Down Expand Up @@ -43766,13 +43752,6 @@
"valType": "string"
},
"error_x": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "style",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -43794,7 +43773,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "style",
"valType": "color"
},
Expand Down Expand Up @@ -43866,13 +43845,6 @@
}
},
"error_y": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "style",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -43894,7 +43866,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "style",
"valType": "color"
},
Expand Down Expand Up @@ -64053,13 +64025,6 @@
"valType": "number"
},
"error_x": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "style",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -64081,7 +64046,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "style",
"valType": "color"
},
Expand Down Expand Up @@ -64153,13 +64118,6 @@
}
},
"error_y": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "style",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -64181,7 +64139,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "style",
"valType": "color"
},
Expand Down Expand Up @@ -66984,13 +66942,6 @@
"valType": "string"
},
"error_x": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "calc",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -67012,7 +66963,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "calc",
"valType": "color"
},
Expand Down Expand Up @@ -67084,13 +67035,6 @@
}
},
"error_y": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "calc",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -67112,7 +67056,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "calc",
"valType": "color"
},
Expand Down Expand Up @@ -67184,13 +67128,6 @@
}
},
"error_z": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "calc",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -67212,7 +67149,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "calc",
"valType": "color"
},
Expand Down Expand Up @@ -74702,13 +74639,6 @@
"valType": "number"
},
"error_x": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "calc",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -74730,7 +74660,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "calc",
"valType": "color"
},
Expand Down Expand Up @@ -74802,13 +74732,6 @@
}
},
"error_y": {
"_deprecated": {
"opacity": {
"description": "Obsolete. Use the alpha channel in error bar `color` to set the opacity.",
"editType": "calc",
"valType": "number"
}
},
"array": {
"description": "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.",
"editType": "calc",
Expand All @@ -74830,7 +74753,7 @@
"valType": "string"
},
"color": {
"description": "Sets the stoke color of the error bars.",
"description": "Sets the stroke color of the error bars.",
"editType": "calc",
"valType": "color"
},
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.