get_computed_values() with support for axis_ranges and axis_types (#5552)#5570
Open
Khanz9664 wants to merge 14 commits intoplotly:mainfrom
Open
get_computed_values() with support for axis_ranges and axis_types (#5552)#5570Khanz9664 wants to merge 14 commits intoplotly:mainfrom
Khanz9664 wants to merge 14 commits intoplotly:mainfrom
Conversation
Implements an initial version of get_computed_values() as proposed in plotly#5552. Supports retrieval of computed axis ranges (axis_ranges) using a lightweight interface built on top of full_figure_for_development(). Includes input validation, safe layout traversal, JSON-serializable outputs, and unit tests for basic, multi-axis, and edge case scenarios.
…nt the new feature.
Pr2 axis types
Pr2 axis types
Author
|
Hi! This is my first contribution to the project. I noticed that the workflow is awaiting approval to run. Thank you! |
Contributor
|
@Khanz9664 Done! Sorry for the inconvenience, we are migrating our CI pipelines at the moment and some settings may change for the next few weeks. You should be good to go for this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue
#5552 - [FEATURE]: Access values calculated / derived by plotly.js as part of plotting
Closes #5552
Description of change
This PR introduces an initial implementation of
get_computed_values()to expose values computed by Plotly.js in a structured and programmatic way.The implementation supports retrieval of:
axis_ranges: The final computed [min, max] range for each axisaxis_types: The detected axis type (e.g., linear, log, date, category)Key aspects of this implementation:
full_figure_for_development()to return only requested computed valuesstartswithapproach to identify axis keys (e.g.,xaxis,yaxis,xaxis2)includeparameter and early return for empty inputDemo
Testing strategy
Added a comprehensive test suite in tests/test_core/test_update_objects/test_get_computed_values.py:
Note: Tests use mocking for the Kaleido rendering engine to ensure environment-agnostic reliability during CI.
Additional information (optional)
This implementation establishes the API structure for accessing computed Plotly.js values and demonstrates its extensibility by supporting multiple properties (axis_ranges, axis_types) using a scalable single-pass design.
Future extensions could include:
Guidelines