Repository navigation
Open
Labels
enhancementNew feature or request
Description
Need
A user wants to show two quantities with different units on one figure, for example temperature and pressure on one time axis. Plotly does this with a second y-axis (yaxis2 with overlaying: "y"). FlexViz cannot draw a second axis.
Current state
- Every cartesian trace stores its render anchors in
TraceSpec.axes. The default is("x", "y"). The engine uses the anchors to route viewport and selection events. - refactor(figure)!: remove the public axes parameter #110 removes the public
axes=parameter fromFigure.add_*, because a trace on another anchor ignored zoom (A trace on an axis other than x or y ignores zoom; remove the public axes= parameter #84). After refactor(figure)!: remove the public axes parameter #110, no public API sets a second anchor. - The Plotly adapter draws every trace on
xaxisandyaxis, and sends viewport keys for those two axes only.
What is needed
- Adapter. Draw the second axis (
yaxis2withoverlaying: "y"andside: "right", and maybexaxis2). Send its viewport key (fig/y2). Give it the same zoom, reset and lock controls as the main axes. - Engine to trace.
_trace_update_range(flexviz/engine.py) keysupdate_rangeby anchor id, for example"y2". The traces read it by role:hist.pyreadsprop_key,hist2d.pyreads"x"and"y", andline.pyreads"x". Map anchor to role before the trace reads the range. A line on("x", "y2")works now, because it re-aggregates onxonly. A horizontal histogram on("x", "y2")does not. - Cube path. The target lookup in
FlexEngine.build_cubes(flexviz/engine.py,_axis_range) readsbackend_data.get(axis), butbackend_datais keyed by role. A temporal zoom onx2becomes the full data domain, and a hist2d target ony2skips the full-data gate. - Shared histogram domains.
_histogram_domain_cols_by_uidhas a latent anchor mismatch for secondary axes (seeArchitecture.md, cube section). - Anchor validation.
figure_axis_columns(flexviz/spec.py) assumes thataxes[0]is an x anchor andaxes[1]is a y anchor.axes=("y", "x")maps the columns to the wrong axes (Axis handling gaps found while reviewing linked axes #81 item 2). Reject that form in the spec. - Linked axes. The
DashboardSpecvalidator accepts onlyxandyin a link group. Decide ify2can link. - Public API. Add the option back only after items 1 to 5 work. A single flag, for example
add_line(..., secondary_y=True), is simpler than a free anchor tuple. - Tests. Engine tests for zoom on the second axis. A browser test that a zoom on
y2re-aggregates a trace that bindsy2, and that a zoom onxstill re-aggregates a line on("x", "y2").
Update Architecture.md when the anchor contract changes.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity