-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Feature: Plot layout images #525
Conversation
As well as creating the attributes and defaults, a default argument has been added to `axes.coerceRef`.
@@ -182,6 +182,7 @@ module.exports = { | |||
'legend': 'Legend', | |||
'annotations': 'Annotations', | |||
'shapes': 'Shapes', | |||
'images': 'Images', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdtusz Looking great. Here are my TODOs:
|
I'm not too sure how best to deal with shapes/images layering. I'd prefer if we kept it absolute so there's less convoluted logic on the layering though (and also, it would get pretty messy trying to define the order they are drawn). Images are on top right now purely because of the order their |
good call.
+1. Let's go with that. |
* // returns { nested: { test: [null, null, { path: 'value' }]} | ||
* | ||
* @param {string} path to nested value | ||
* @param {*} any value to be set | ||
* | ||
* @return {Object} the constructed object with a full nested path | ||
*/ | ||
lib.toObject = function(path, value) { | ||
lib.objectFromPath = function(path, value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an even more verbose plotly-esque name would be Lib.objectFromAttributeString
or Lib.objectFromAstr
.
@mdtusz I'll leave it up to you to decide what's best.
💃 |
Continuing from before - fulfilling #496:
This PR adds the ability to add arbitrary images loaded from a url to a plot. Plot layout images follow a similar interface to shapes, but use a coordinate position with
sizex
andsizey
rather thanx0
,x1
,y0
,y1
. Additionally, there are three sizing modes -contain
(the default),fill
, andstretch
.The intended use of this feature is mainly for logos and non-data-specific images - for image data that is tied directly to data (e.g. satellite imagery) we should/will add a new trace type to accommodate for this and enable features such as toggling from the legend and ordering.
That said, images can be added to the plot area and be forced to keep their binding to the underlying cartesian plane by setting the
xref
andyref
to their respective axes and setting thesizing
property tostretch
.Since the initial PR, a few things have been changed:
gd._promises
width
/height
have been changed tosizex
/sizey