Commit eccb469
committed
Go completely path-based / dynamic. (messy commit)
This is a non-trivial refactor to make attributes dynamically correct
based on a plotly object’s position in a figure.
Changes:
* all objects know all possible attributes and their paths, always
For example, `Marker` alone has *many* possible attributes/definitions,
but when it’s nested in the context of `Pie`, it only has *one* possible
definition. This is the major reason for all this work.
* graph objects no longer have *set* `_attributes` or `_items` lists.
This means that we *always* lookup such information based on the current
location of the object.
* graph objects are always path-aware
Previously, graph objects `_parent` and `_parent_key` were set after
conversion to a graph object was complete. This is now done *first*.
Note that lists also have a `_path_key` now. Also note that
instantiating an object nested in another object can’t possibly know
about it’s path. This may need to be revisited if we want to round out
errors. Not a big deal in practice though, imo.
* error handling is cleaned up a bit
Since paths are always known (except for the case above), we can get
rid of a lot of the complex error handling.
* `Layout` is auto-generated
`Layout` doesn’t need to be patched anymore after these changes :)
* class creation is simplified
Now that all the attribute information comes from `graph_reference`, we
can greatly simplify logic around dynamic class creation.1 parent 992a73a commit eccb469
3 files changed
Lines changed: 314 additions & 479 deletions
0 commit comments