Type trace axis ids#392
Conversation
7717f12 to
778ee1f
Compare
|
Hi @RedZapdos123, Thank you for the PR. And thank you for the work on the CI fixes. I propose that you make a new PR with the CI fixes to separate it from this PR. Concerning the original issue, the axis IDs, can you give me a bit more context on why you opened an issue in Regarding the fix itself. This crate is trying to follow So I don't think using an Enum here brings much improvement but rather more complexity and I would prefer not to follow this approach. |
Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
b4a4ed9 to
86111f3
Compare
Thank you for the review. I split the CI work out as requested.
I also reworked the #392 to avoid the enum approach. The current version keeps the existing string-based axis ids, but gives them named types:
The trace fields now use those types, and the setters accept I also added regression tests for both paths:
About the 'plotly.py' issue reference. I opened it because the original problem is about the user facing axis-id API feeling unclear from a Plotly user point of view. But I agree that |
Description:
Issue plotly/plotly.py#5583 points out that trace
x_axisandy_axissetters are not self-explanatory because users have to discover values like"x2"and"y3"from examples.This PR keeps the existing string-based axis ids, but gives them named types:
XAxisIdYAxisIdThe trace fields now use those named axis-id string types, and the trace setters accept
impl Into<XAxisId>/impl Into<YAxisId>so existing string inputs continue to work without introducing an enum or a hardcoded axis limit.It also adds regression tests for both code paths:
Scatter)Contour)This PR does not include the CI fixes from #397 which have been moved there unlike earlier.
Checklist:
cargo +nightly fmt --all -- --checkandcd examples && cargo +nightly fmt --all -- --check.cargo clippy -p plotly -p plotly_derive -- -D warnings -A deprecated.cargo test -p plotly axis_id --features static_export_chromedriver.cargo test -p plotly --features plotly_ndarray,plotly_image,static_export_chromedriver,debug.The validation screenshots of the tests run, locally: