Skip to content
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

Expose PlotLegend and ScalarAxis (axis_y) properties on TimeSeriesView blueprint #6114

Merged
merged 8 commits into from
Apr 26, 2024

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Apr 25, 2024

What

Usage example:

# ...
            # Plot with custom Y range that is locked into place during zoom and legend at the bottom left.
            rrb.TimeSeriesView(
                origin="/plot",
                axis_y=rrb.ScalarAxis(range=[0, 1], lock_range_during_zoom=True),
                plot_legend=rrb.Corner2D.LeftBottom,
            ),
            # Hide plot legend
            rrb.TimeSeriesView(
                origin="/plot",
                plot_legend=rrb.PlotLegend(visible=False),
            ),
# ...

Changed codegen type definition:

/// A time series view.
table TimeSeriesView (
    "attr.rerun.view_identifier": "TimeSeries"
) {
    /// Configures the vertical axis of the plot.
    axis_y: rerun.blueprint.archetypes.ScalarAxis (order: 1000);

    /// Configures the legend of the plot.
    plot_legend: rerun.blueprint.archetypes.PlotLegend (order: 2000);
}

Added the necessary serialization code and snippets. More aggressively using datatypes now to reduce amount of serialization code we need to write in Python.

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!

To run all checks from main, comment on the PR with @rerun-bot full-check.

@Wumpf Wumpf added 🐍 Python API Python logging API 🟦 blueprint The data that defines our UI include in changelog labels Apr 25, 2024
Copy link

github-actions bot commented Apr 25, 2024

Deployed docs

Commit Link
8ba76cd https://landing-oq8fyro82-rerun.vercel.app/docs

Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to describe in the PR how a user can set these properties from code. They will want to know when they click the PR link in the changelog!

"attr.rust.repr": "transparent",
"attr.rust.tuple_struct"
) {
lock_range: bool (order: 100);
lock_range: rerun.datatypes.Bool (order: 100);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we sometimes prefer bool over rerun.datatypes.Bool and the other way around?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should always prefer it in Components. We want to get to a place where components always forward to a datatype. Not only will this get us closer to a place where components are a thin semantic layer, it also means I don't have to implement bool serialization again and again in Python (and it won't be generated either for C++, Rust is the odd one out where we regenerate a lot of stuff all the time, to be fixed).
We're not consequent in this yet, but it's already happening e.g. with PanelExpanded

crates/re_types/src/components/range1d_ext.rs Show resolved Hide resolved
"set_time_seconds",
"set_time_sequence",
"send_blueprint",
"spawn",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder who has the type-sensitive sorter. I guess we'll find out in a PR soon enough

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Wumpf
Copy link
Member Author

Wumpf commented Apr 25, 2024

added usage example that we can then also use for snippets. Also improved ergonomics to make this possible in the first place

@Wumpf Wumpf merged commit 2b4c22e into main Apr 26, 2024
39 checks passed
@Wumpf Wumpf deleted the andreas/timeseries-properties-python branch April 26, 2024 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🟦 blueprint The data that defines our UI include in changelog 🐍 Python API Python logging API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants