From b4e274ded0d4e164cba574953e5b013e2e8da9d2 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Wed, 25 Sep 2024 19:22:59 +0200 Subject: [PATCH] Add a stub Dataframe view blueprint and improve the generated doc --- .../re_types_builder/src/codegen/docs/mod.rs | 40 ++++--- .../definitions/rerun/blueprint/views.fbs | 1 + .../rerun/blueprint/views/dataframe.fbs | 13 +++ .../src/blueprint/views/.gitattributes | 1 + .../src/blueprint/views/dataframe_view.rs | 42 +++++++ .../store/re_types/src/blueprint/views/mod.rs | 2 + .../types/archetypes/annotation_context.md | 1 + .../reference/types/archetypes/arrows2d.md | 1 + .../reference/types/archetypes/arrows3d.md | 1 + .../reference/types/archetypes/asset3d.md | 1 + .../reference/types/archetypes/asset_video.md | 3 + .../reference/types/archetypes/bar_chart.md | 1 + .../reference/types/archetypes/boxes2d.md | 1 + .../reference/types/archetypes/boxes3d.md | 1 + .../reference/types/archetypes/clear.md | 1 + .../reference/types/archetypes/depth_image.md | 1 + .../types/archetypes/disconnected_space.md | 1 + .../types/archetypes/ellipsoids3d.md | 1 + .../types/archetypes/encoded_image.md | 1 + .../reference/types/archetypes/image.md | 1 + .../types/archetypes/instance_poses3d.md | 1 + .../types/archetypes/line_strips2d.md | 1 + .../types/archetypes/line_strips3d.md | 1 + .../reference/types/archetypes/mesh3d.md | 1 + .../reference/types/archetypes/pinhole.md | 1 + .../reference/types/archetypes/points2d.md | 1 + .../reference/types/archetypes/points3d.md | 1 + .../reference/types/archetypes/scalar.md | 1 + .../types/archetypes/segmentation_image.md | 1 + .../reference/types/archetypes/series_line.md | 1 + .../types/archetypes/series_point.md | 1 + .../reference/types/archetypes/tensor.md | 1 + .../types/archetypes/text_document.md | 1 + .../reference/types/archetypes/text_log.md | 1 + .../reference/types/archetypes/transform3d.md | 1 + .../types/archetypes/video_frame_reference.md | 3 + .../types/archetypes/view_coordinates.md | 1 + docs/content/reference/types/views.md | 1 + .../reference/types/views/.gitattributes | 1 + .../reference/types/views/dataframe_view.md | 22 ++++ docs/snippets/all/views/dataframe.py | 26 +++++ .../rerun_sdk/rerun/blueprint/__init__.py | 1 + .../rerun/blueprint/views/.gitattributes | 1 + .../rerun/blueprint/views/__init__.py | 2 + .../rerun/blueprint/views/dataframe_view.py | 105 ++++++++++++++++++ 45 files changed, 279 insertions(+), 14 deletions(-) create mode 100644 crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs create mode 100644 crates/store/re_types/src/blueprint/views/dataframe_view.rs create mode 100644 docs/content/reference/types/views/dataframe_view.md create mode 100644 docs/snippets/all/views/dataframe.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py diff --git a/crates/build/re_types_builder/src/codegen/docs/mod.rs b/crates/build/re_types_builder/src/codegen/docs/mod.rs index dbf83d512465..7a304ff4eb78 100644 --- a/crates/build/re_types_builder/src/codegen/docs/mod.rs +++ b/crates/build/re_types_builder/src/codegen/docs/mod.rs @@ -12,6 +12,8 @@ use crate::{ ATTR_DOCS_VIEW_TYPES, }; +pub const DATAFRAME_VIEW_FQNAME: &str = "rerun.blueprint.views.DataframeView"; + macro_rules! putln { ($o:ident) => ( writeln!($o).ok() ); ($o:ident, $($tt:tt)*) => ( writeln!($o, $($tt)*).ok() ); @@ -574,9 +576,10 @@ fn write_archetype_fields( putln!(page, "**Optional**: {}", optional.join(", ")); } + putln!(page); + putln!(page, "## Shown in"); + if let Some(view_types) = view_per_archetype.get(&object.fqname) { - putln!(page); - putln!(page, "## Shown in"); for ViewReference { view_name, explanation, @@ -592,6 +595,9 @@ fn write_archetype_fields( putln!(page); } } + + // Special case for dataframe view: it can display anything. + putln!(page, "* [DataframeView](../views/dataframe_view.md)"); } fn write_visualized_archetypes( @@ -614,7 +620,7 @@ fn write_visualized_archetypes( } } - if archetype_fqnames.is_empty() { + if archetype_fqnames.is_empty() && view.fqname != DATAFRAME_VIEW_FQNAME { reporter.error(&view.virtpath, &view.fqname, "No archetypes use this view."); return; } @@ -624,18 +630,24 @@ fn write_visualized_archetypes( putln!(page, "## Visualized archetypes"); putln!(page); - for (fqname, explanation) in archetype_fqnames { - let object = &objects[&fqname]; - page.push_str(&format!( - "* [`{}`](../{}/{}.md)", - object.name, - object.kind.plural_snake_case(), - object.snake_case_name() - )); - if let Some(explanation) = explanation { - page.push_str(&format!(" ({explanation})")); + + // special case for dataframe view + if view.fqname == DATAFRAME_VIEW_FQNAME { + putln!(page, "Any data can be displayed by the Dataframe view."); + } else { + for (fqname, explanation) in archetype_fqnames { + let object = &objects[&fqname]; + page.push_str(&format!( + "* [`{}`](../{}/{}.md)", + object.name, + object.kind.plural_snake_case(), + object.snake_case_name() + )); + if let Some(explanation) = explanation { + page.push_str(&format!(" ({explanation})")); + } + putln!(page); } - putln!(page); } putln!(page); } diff --git a/crates/store/re_types/definitions/rerun/blueprint/views.fbs b/crates/store/re_types/definitions/rerun/blueprint/views.fbs index 5857977a2cd5..bf6def5f9e96 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/views.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/views.fbs @@ -1,6 +1,7 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/fbs/mod.rs include "./views/bar_chart.fbs"; +include "./views/dataframe.fbs"; include "./views/spatial2d.fbs"; include "./views/spatial3d.fbs"; include "./views/tensor.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs b/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs new file mode 100644 index 000000000000..8c9fd47687a0 --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs @@ -0,0 +1,13 @@ +namespace rerun.blueprint.views; + +/// A view to display any data in a tabular form. +/// +/// \example views/dataframe title="Use a blueprint to customize a DataframeView." +//TODO(#6896): add a thumbnail when the example becomes interesting +table DataframeView ( + "attr.rerun.view_identifier": "Dataframe" +) { + /// Query of the dataframe. + //TODO(#6896): this will be enabled in a later PR in the chain + //query: rerun.blueprint.archetypes.DataframeQueryV2 (order: 1000); +} diff --git a/crates/store/re_types/src/blueprint/views/.gitattributes b/crates/store/re_types/src/blueprint/views/.gitattributes index 72c9570d24e2..6b3cbae85b75 100644 --- a/crates/store/re_types/src/blueprint/views/.gitattributes +++ b/crates/store/re_types/src/blueprint/views/.gitattributes @@ -2,6 +2,7 @@ .gitattributes linguist-generated=true bar_chart_view.rs linguist-generated=true +dataframe_view.rs linguist-generated=true mod.rs linguist-generated=true spatial2d_view.rs linguist-generated=true spatial3d_view.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/views/dataframe_view.rs b/crates/store/re_types/src/blueprint/views/dataframe_view.rs new file mode 100644 index 000000000000..ecfb1aebcb23 --- /dev/null +++ b/crates/store/re_types/src/blueprint/views/dataframe_view.rs @@ -0,0 +1,42 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::ComponentName; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **View**: A view to display any data in a tabular form. +#[derive(Clone, Debug)] +pub struct DataframeView {} + +impl ::re_types_core::SizeBytes for DataframeView { + #[inline] + fn heap_size_bytes(&self) -> u64 { + 0 + } + + #[inline] + fn is_pod() -> bool { + true + } +} + +impl ::re_types_core::View for DataframeView { + #[inline] + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "Dataframe".into() + } +} diff --git a/crates/store/re_types/src/blueprint/views/mod.rs b/crates/store/re_types/src/blueprint/views/mod.rs index 5ba9a3625be0..331985ec849b 100644 --- a/crates/store/re_types/src/blueprint/views/mod.rs +++ b/crates/store/re_types/src/blueprint/views/mod.rs @@ -1,6 +1,7 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs mod bar_chart_view; +mod dataframe_view; mod spatial2d_view; mod spatial3d_view; mod tensor_view; @@ -9,6 +10,7 @@ mod text_log_view; mod time_series_view; pub use self::bar_chart_view::BarChartView; +pub use self::dataframe_view::DataframeView; pub use self::spatial2d_view::Spatial2DView; pub use self::spatial3d_view::Spatial3DView; pub use self::tensor_view::TensorView; diff --git a/docs/content/reference/types/archetypes/annotation_context.md b/docs/content/reference/types/archetypes/annotation_context.md index f1e1195f57f6..a9850dde6c0b 100644 --- a/docs/content/reference/types/archetypes/annotation_context.md +++ b/docs/content/reference/types/archetypes/annotation_context.md @@ -20,6 +20,7 @@ See also [`datatypes.ClassDescription`](https://rerun.io/docs/reference/types/da ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `AnnotationContext`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1AnnotationContext.html) diff --git a/docs/content/reference/types/archetypes/arrows2d.md b/docs/content/reference/types/archetypes/arrows2d.md index a281f754e12f..40564b6514bc 100644 --- a/docs/content/reference/types/archetypes/arrows2d.md +++ b/docs/content/reference/types/archetypes/arrows2d.md @@ -16,6 +16,7 @@ title: "Arrows2D" ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) (if logged under a projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Arrows2D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Arrows2D.html) diff --git a/docs/content/reference/types/archetypes/arrows3d.md b/docs/content/reference/types/archetypes/arrows3d.md index 2265f502af29..937223f432ba 100644 --- a/docs/content/reference/types/archetypes/arrows3d.md +++ b/docs/content/reference/types/archetypes/arrows3d.md @@ -16,6 +16,7 @@ title: "Arrows3D" ## Shown in * [Spatial3DView](../views/spatial3d_view.md) * [Spatial2DView](../views/spatial2d_view.md) (if logged above active projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Arrows3D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Arrows3D.html) diff --git a/docs/content/reference/types/archetypes/asset3d.md b/docs/content/reference/types/archetypes/asset3d.md index e15d67cc3740..145fb8cfa15d 100644 --- a/docs/content/reference/types/archetypes/asset3d.md +++ b/docs/content/reference/types/archetypes/asset3d.md @@ -19,6 +19,7 @@ an instance of the mesh will be drawn for each transform. ## Shown in * [Spatial3DView](../views/spatial3d_view.md) * [Spatial2DView](../views/spatial2d_view.md) (if logged above active projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Asset3D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Asset3D.html) diff --git a/docs/content/reference/types/archetypes/asset_video.md b/docs/content/reference/types/archetypes/asset_video.md index d7d67b6af057..7126e4c028f8 100644 --- a/docs/content/reference/types/archetypes/asset_video.md +++ b/docs/content/reference/types/archetypes/asset_video.md @@ -20,6 +20,9 @@ In order to display a video, you need to log a [`archetypes.VideoFrameReference` **Recommended**: [`MediaType`](../components/media_type.md) +## Shown in +* [DataframeView](../views/dataframe_view.md) + ## API reference links * 🌊 [C++ API docs for `AssetVideo`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1AssetVideo.html?speculative-link) * 🐍 [Python API docs for `AssetVideo`](https://ref.rerun.io/docs/python/stable/common/archetypes?speculative-link#rerun.archetypes.AssetVideo) diff --git a/docs/content/reference/types/archetypes/bar_chart.md b/docs/content/reference/types/archetypes/bar_chart.md index 2991afcfb7fd..6f2e286bd923 100644 --- a/docs/content/reference/types/archetypes/bar_chart.md +++ b/docs/content/reference/types/archetypes/bar_chart.md @@ -15,6 +15,7 @@ The x values will be the indices of the array, and the bar heights will be the p ## Shown in * [BarChartView](../views/bar_chart_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `BarChart`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1BarChart.html) diff --git a/docs/content/reference/types/archetypes/boxes2d.md b/docs/content/reference/types/archetypes/boxes2d.md index d8733694c78c..c1b9c9c424e4 100644 --- a/docs/content/reference/types/archetypes/boxes2d.md +++ b/docs/content/reference/types/archetypes/boxes2d.md @@ -16,6 +16,7 @@ title: "Boxes2D" ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) (if logged under a projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Boxes2D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Boxes2D.html) diff --git a/docs/content/reference/types/archetypes/boxes3d.md b/docs/content/reference/types/archetypes/boxes3d.md index 5951c6cdef20..ef33d29fcfc2 100644 --- a/docs/content/reference/types/archetypes/boxes3d.md +++ b/docs/content/reference/types/archetypes/boxes3d.md @@ -20,6 +20,7 @@ If there's more instance poses than half sizes, the last half size will be repea ## Shown in * [Spatial3DView](../views/spatial3d_view.md) * [Spatial2DView](../views/spatial2d_view.md) (if logged above active projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Boxes3D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Boxes3D.html) diff --git a/docs/content/reference/types/archetypes/clear.md b/docs/content/reference/types/archetypes/clear.md index a22bca19571d..476fcb56470b 100644 --- a/docs/content/reference/types/archetypes/clear.md +++ b/docs/content/reference/types/archetypes/clear.md @@ -23,6 +23,7 @@ data (i.e. discontinuous lines). * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) * [TimeSeriesView](../views/time_series_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Clear`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Clear.html) diff --git a/docs/content/reference/types/archetypes/depth_image.md b/docs/content/reference/types/archetypes/depth_image.md index b2ec72e6b1d2..f302a332b25b 100644 --- a/docs/content/reference/types/archetypes/depth_image.md +++ b/docs/content/reference/types/archetypes/depth_image.md @@ -16,6 +16,7 @@ Each pixel corresponds to a depth value in units specified by [`components.Depth ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) (if logged under a projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `DepthImage`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1DepthImage.html) diff --git a/docs/content/reference/types/archetypes/disconnected_space.md b/docs/content/reference/types/archetypes/disconnected_space.md index 3d61de94cf05..eacd122ed166 100644 --- a/docs/content/reference/types/archetypes/disconnected_space.md +++ b/docs/content/reference/types/archetypes/disconnected_space.md @@ -17,6 +17,7 @@ This is useful for specifying that a subgraph is independent of the rest of the ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `DisconnectedSpace`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1DisconnectedSpace.html) diff --git a/docs/content/reference/types/archetypes/ellipsoids3d.md b/docs/content/reference/types/archetypes/ellipsoids3d.md index 1d2d8de2642e..faeaba7a7b94 100644 --- a/docs/content/reference/types/archetypes/ellipsoids3d.md +++ b/docs/content/reference/types/archetypes/ellipsoids3d.md @@ -24,6 +24,7 @@ If there's more instance poses than half sizes, the last half size will be repea ## Shown in * [Spatial3DView](../views/spatial3d_view.md) * [Spatial2DView](../views/spatial2d_view.md) (if logged above active projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Ellipsoids3D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Ellipsoids3D.html) diff --git a/docs/content/reference/types/archetypes/encoded_image.md b/docs/content/reference/types/archetypes/encoded_image.md index 70eef2932a0f..e824f2f3ff8d 100644 --- a/docs/content/reference/types/archetypes/encoded_image.md +++ b/docs/content/reference/types/archetypes/encoded_image.md @@ -18,6 +18,7 @@ Rerun also supports uncompressed images with the [`archetypes.Image`](https://re ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) (if logged under a projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `EncodedImage`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1EncodedImage.html) diff --git a/docs/content/reference/types/archetypes/image.md b/docs/content/reference/types/archetypes/image.md index d07439d9e68e..a2f2f64bf9df 100644 --- a/docs/content/reference/types/archetypes/image.md +++ b/docs/content/reference/types/archetypes/image.md @@ -26,6 +26,7 @@ Compressing images can save a lot of bandwidth and memory. ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) (if logged under a projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Image`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Image.html) diff --git a/docs/content/reference/types/archetypes/instance_poses3d.md b/docs/content/reference/types/archetypes/instance_poses3d.md index f45369215c47..08860bdebfe0 100644 --- a/docs/content/reference/types/archetypes/instance_poses3d.md +++ b/docs/content/reference/types/archetypes/instance_poses3d.md @@ -23,6 +23,7 @@ the 3x3 matrix is applied first, followed by the translation. ## Shown in * [Spatial3DView](../views/spatial3d_view.md) * [Spatial2DView](../views/spatial2d_view.md) (if logged above active projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `InstancePoses3D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1InstancePoses3D.html) diff --git a/docs/content/reference/types/archetypes/line_strips2d.md b/docs/content/reference/types/archetypes/line_strips2d.md index fca6ad867449..dde4074a399d 100644 --- a/docs/content/reference/types/archetypes/line_strips2d.md +++ b/docs/content/reference/types/archetypes/line_strips2d.md @@ -16,6 +16,7 @@ title: "LineStrips2D" ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) (if logged under a projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `LineStrips2D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1LineStrips2D.html) diff --git a/docs/content/reference/types/archetypes/line_strips3d.md b/docs/content/reference/types/archetypes/line_strips3d.md index 3074b499cdc8..ab9c01704820 100644 --- a/docs/content/reference/types/archetypes/line_strips3d.md +++ b/docs/content/reference/types/archetypes/line_strips3d.md @@ -16,6 +16,7 @@ title: "LineStrips3D" ## Shown in * [Spatial3DView](../views/spatial3d_view.md) * [Spatial2DView](../views/spatial2d_view.md) (if logged above active projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `LineStrips3D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1LineStrips3D.html) diff --git a/docs/content/reference/types/archetypes/mesh3d.md b/docs/content/reference/types/archetypes/mesh3d.md index 2229353abe86..3546920a0238 100644 --- a/docs/content/reference/types/archetypes/mesh3d.md +++ b/docs/content/reference/types/archetypes/mesh3d.md @@ -21,6 +21,7 @@ an instance of the mesh will be drawn for each transform. ## Shown in * [Spatial3DView](../views/spatial3d_view.md) * [Spatial2DView](../views/spatial2d_view.md) (if logged above active projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Mesh3D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Mesh3D.html) diff --git a/docs/content/reference/types/archetypes/pinhole.md b/docs/content/reference/types/archetypes/pinhole.md index 89233ddf6d6d..06a456ba5c46 100644 --- a/docs/content/reference/types/archetypes/pinhole.md +++ b/docs/content/reference/types/archetypes/pinhole.md @@ -16,6 +16,7 @@ Camera perspective projection (a.k.a. intrinsics). ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial2DView](../views/spatial2d_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Pinhole`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Pinhole.html) diff --git a/docs/content/reference/types/archetypes/points2d.md b/docs/content/reference/types/archetypes/points2d.md index 553c1879d9f6..69395fd5fa0b 100644 --- a/docs/content/reference/types/archetypes/points2d.md +++ b/docs/content/reference/types/archetypes/points2d.md @@ -16,6 +16,7 @@ A 2D point cloud with positions and optional colors, radii, labels, etc. ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) (if logged under a projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Points2D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Points2D.html) diff --git a/docs/content/reference/types/archetypes/points3d.md b/docs/content/reference/types/archetypes/points3d.md index 3cf0c8117a17..6b83466c7381 100644 --- a/docs/content/reference/types/archetypes/points3d.md +++ b/docs/content/reference/types/archetypes/points3d.md @@ -16,6 +16,7 @@ A 3D point cloud with positions and optional colors, radii, labels, etc. ## Shown in * [Spatial3DView](../views/spatial3d_view.md) * [Spatial2DView](../views/spatial2d_view.md) (if logged above active projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Points3D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Points3D.html) diff --git a/docs/content/reference/types/archetypes/scalar.md b/docs/content/reference/types/archetypes/scalar.md index 7b904e887339..b75e7960f4a0 100644 --- a/docs/content/reference/types/archetypes/scalar.md +++ b/docs/content/reference/types/archetypes/scalar.md @@ -19,6 +19,7 @@ the plot-specific archetypes through the blueprint. ## Shown in * [TimeSeriesView](../views/time_series_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Scalar`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Scalar.html) diff --git a/docs/content/reference/types/archetypes/segmentation_image.md b/docs/content/reference/types/archetypes/segmentation_image.md index b8a5958c7128..d6fd1a5c1543 100644 --- a/docs/content/reference/types/archetypes/segmentation_image.md +++ b/docs/content/reference/types/archetypes/segmentation_image.md @@ -21,6 +21,7 @@ See also [`archetypes.AnnotationContext`](https://rerun.io/docs/reference/types/ ## Shown in * [Spatial2DView](../views/spatial2d_view.md) * [Spatial3DView](../views/spatial3d_view.md) (if logged under a projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `SegmentationImage`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1SegmentationImage.html) diff --git a/docs/content/reference/types/archetypes/series_line.md b/docs/content/reference/types/archetypes/series_line.md index 204dc77825f8..a35379f1b8e9 100644 --- a/docs/content/reference/types/archetypes/series_line.md +++ b/docs/content/reference/types/archetypes/series_line.md @@ -15,6 +15,7 @@ when possible. The underlying data needs to be logged to the same entity-path us ## Shown in * [TimeSeriesView](../views/time_series_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `SeriesLine`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1SeriesLine.html) diff --git a/docs/content/reference/types/archetypes/series_point.md b/docs/content/reference/types/archetypes/series_point.md index 16146b2ad0ab..c2163b8e2638 100644 --- a/docs/content/reference/types/archetypes/series_point.md +++ b/docs/content/reference/types/archetypes/series_point.md @@ -15,6 +15,7 @@ when possible. The underlying data needs to be logged to the same entity-path us ## Shown in * [TimeSeriesView](../views/time_series_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `SeriesPoint`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1SeriesPoint.html) diff --git a/docs/content/reference/types/archetypes/tensor.md b/docs/content/reference/types/archetypes/tensor.md index a0bff263a4fa..e6567d0d9cd4 100644 --- a/docs/content/reference/types/archetypes/tensor.md +++ b/docs/content/reference/types/archetypes/tensor.md @@ -12,6 +12,7 @@ An N-dimensional array of numbers. ## Shown in * [TensorView](../views/tensor_view.md) * [BarChartView](../views/bar_chart_view.md) (for 1D tensors) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Tensor`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Tensor.html) diff --git a/docs/content/reference/types/archetypes/text_document.md b/docs/content/reference/types/archetypes/text_document.md index 5c93ef4fd605..e7b481d14b6f 100644 --- a/docs/content/reference/types/archetypes/text_document.md +++ b/docs/content/reference/types/archetypes/text_document.md @@ -15,6 +15,7 @@ Supports raw text and markdown. ## Shown in * [TextDocumentView](../views/text_document_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `TextDocument`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1TextDocument.html) diff --git a/docs/content/reference/types/archetypes/text_log.md b/docs/content/reference/types/archetypes/text_log.md index 645a2fd889ab..96ce9f014dca 100644 --- a/docs/content/reference/types/archetypes/text_log.md +++ b/docs/content/reference/types/archetypes/text_log.md @@ -15,6 +15,7 @@ A log entry in a text log, comprised of a text body and its log level. ## Shown in * [TextLogView](../views/text_log_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `TextLog`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1TextLog.html) diff --git a/docs/content/reference/types/archetypes/transform3d.md b/docs/content/reference/types/archetypes/transform3d.md index df78ab1a4907..058d8c0ef60f 100644 --- a/docs/content/reference/types/archetypes/transform3d.md +++ b/docs/content/reference/types/archetypes/transform3d.md @@ -21,6 +21,7 @@ it will be resolved to a transform with only a rotation. ## Shown in * [Spatial3DView](../views/spatial3d_view.md) * [Spatial2DView](../views/spatial2d_view.md) (if logged above active projection) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `Transform3D`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1Transform3D.html) diff --git a/docs/content/reference/types/archetypes/video_frame_reference.md b/docs/content/reference/types/archetypes/video_frame_reference.md index 89e9a64e5f22..6ddf70f08657 100644 --- a/docs/content/reference/types/archetypes/video_frame_reference.md +++ b/docs/content/reference/types/archetypes/video_frame_reference.md @@ -17,6 +17,9 @@ To show an entire video, a fideo frame reference for each frame of the video sho **Optional**: [`EntityPath`](../components/entity_path.md) +## Shown in +* [DataframeView](../views/dataframe_view.md) + ## API reference links * 🌊 [C++ API docs for `VideoFrameReference`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1VideoFrameReference.html?speculative-link) * 🐍 [Python API docs for `VideoFrameReference`](https://ref.rerun.io/docs/python/stable/common/archetypes?speculative-link#rerun.archetypes.VideoFrameReference) diff --git a/docs/content/reference/types/archetypes/view_coordinates.md b/docs/content/reference/types/archetypes/view_coordinates.md index 9f51cbf74336..68d44f93d9f4 100644 --- a/docs/content/reference/types/archetypes/view_coordinates.md +++ b/docs/content/reference/types/archetypes/view_coordinates.md @@ -20,6 +20,7 @@ Make sure that this archetype is logged at or above the origin entity path of yo ## Shown in * [Spatial3DView](../views/spatial3d_view.md) +* [DataframeView](../views/dataframe_view.md) ## API reference links * 🌊 [C++ API docs for `ViewCoordinates`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1ViewCoordinates.html) diff --git a/docs/content/reference/types/views.md b/docs/content/reference/types/views.md index fff6b159afc6..8d7b8e11948c 100644 --- a/docs/content/reference/types/views.md +++ b/docs/content/reference/types/views.md @@ -8,6 +8,7 @@ Views are the panels shown in the viewer's viewport and the primary means of ins * [`BarChartView`](views/bar_chart_view.md): A bar chart view. +* [`DataframeView`](views/dataframe_view.md): A view to display any data in a tabular form. * [`Spatial2DView`](views/spatial2d_view.md): For viewing spatial 2D data. * [`Spatial3DView`](views/spatial3d_view.md): For viewing spatial 3D data. * [`TensorView`](views/tensor_view.md): A view on a tensor of any dimensionality. diff --git a/docs/content/reference/types/views/.gitattributes b/docs/content/reference/types/views/.gitattributes index 5a454df3b43c..ee86a2002ccb 100644 --- a/docs/content/reference/types/views/.gitattributes +++ b/docs/content/reference/types/views/.gitattributes @@ -2,6 +2,7 @@ .gitattributes linguist-generated=true bar_chart_view.md linguist-generated=true +dataframe_view.md linguist-generated=true spatial2d_view.md linguist-generated=true spatial3d_view.md linguist-generated=true tensor_view.md linguist-generated=true diff --git a/docs/content/reference/types/views/dataframe_view.md b/docs/content/reference/types/views/dataframe_view.md new file mode 100644 index 000000000000..19bc8b949f59 --- /dev/null +++ b/docs/content/reference/types/views/dataframe_view.md @@ -0,0 +1,22 @@ +--- +title: "DataframeView" +--- + + +A view to display any data in a tabular form. + + +## API reference links + * 🐍 [Python API docs for `DataframeView`](https://ref.rerun.io/docs/python/stable/common/blueprint_views#rerun.blueprint.views.DataframeView) + +## Example + +### Use a blueprint to customize a DataframeView. + +snippet: views/dataframe + + +## Visualized archetypes + +Any data can be displayed by the Dataframe view. + diff --git a/docs/snippets/all/views/dataframe.py b/docs/snippets/all/views/dataframe.py new file mode 100644 index 000000000000..c86ea32cb7c1 --- /dev/null +++ b/docs/snippets/all/views/dataframe.py @@ -0,0 +1,26 @@ +"""Use a blueprint to customize a DataframeView.""" + +import math + +import rerun as rr +import rerun.blueprint as rrb + +rr.init("rerun_example_dataframe", spawn=True) + +# Log some data. +rr.log("trig/sin", rr.SeriesLine(color=[255, 0, 0], name="sin(0.01t)"), static=True) +rr.log("trig/cos", rr.SeriesLine(color=[0, 255, 0], name="cos(0.01t)"), static=True) +for t in range(0, int(math.pi * 4 * 100.0)): + rr.set_time_seconds("t", t) + rr.log("trig/sin", rr.Scalar(math.sin(float(t) / 100.0))) + rr.log("trig/cos", rr.Scalar(math.cos(float(t) / 100.0))) + +# Create a Dataframe View +blueprint = rrb.Blueprint( + rrb.DataframeView( + origin="/trig", + # TODO(#6896): add an interesting query here + ), +) + +rr.send_blueprint(blueprint) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/__init__.py index 8d36c2ceab54..0da791c5fb26 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/__init__.py @@ -51,6 +51,7 @@ ) from .views import ( BarChartView as BarChartView, + DataframeView as DataframeView, Spatial2DView as Spatial2DView, Spatial3DView as Spatial3DView, TensorView as TensorView, diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/views/.gitattributes index 7b2ef874ad4d..75df45e0a870 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/.gitattributes @@ -3,6 +3,7 @@ .gitattributes linguist-generated=true __init__.py linguist-generated=true bar_chart_view.py linguist-generated=true +dataframe_view.py linguist-generated=true spatial2d_view.py linguist-generated=true spatial3d_view.py linguist-generated=true tensor_view.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/views/__init__.py index 6a71b704e380..c2aee9b89942 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/__init__.py @@ -3,6 +3,7 @@ from __future__ import annotations from .bar_chart_view import BarChartView +from .dataframe_view import DataframeView from .spatial2d_view import Spatial2DView from .spatial3d_view import Spatial3DView from .tensor_view import TensorView @@ -12,6 +13,7 @@ __all__ = [ "BarChartView", + "DataframeView", "Spatial2DView", "Spatial3DView", "TensorView", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py new file mode 100644 index 000000000000..944680208ede --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py @@ -0,0 +1,105 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs". + +from __future__ import annotations + +from typing import Union + +__all__ = ["DataframeView"] + + +from ... import datatypes +from ..._baseclasses import AsComponents, ComponentBatchLike +from ...datatypes import EntityPathLike, Utf8Like +from ..api import SpaceView, SpaceViewContentsLike + + +class DataframeView(SpaceView): + """ + **View**: A view to display any data in a tabular form. + + Example + ------- + ### Use a blueprint to customize a DataframeView.: + ```python + import math + + import rerun as rr + import rerun.blueprint as rrb + + rr.init("rerun_example_dataframe", spawn=True) + + # Log some data. + rr.log("trig/sin", rr.SeriesLine(color=[255, 0, 0], name="sin(0.01t)"), static=True) + rr.log("trig/cos", rr.SeriesLine(color=[0, 255, 0], name="cos(0.01t)"), static=True) + for t in range(0, int(math.pi * 4 * 100.0)): + rr.set_time_seconds("t", t) + rr.log("trig/sin", rr.Scalar(math.sin(float(t) / 100.0))) + rr.log("trig/cos", rr.Scalar(math.cos(float(t) / 100.0))) + + # Create a Dataframe View + blueprint = rrb.Blueprint( + rrb.DataframeView( + origin="/trig", + # TODO(#6896): add an interesting query here + ), + ) + + rr.send_blueprint(blueprint) + ``` + + """ + + def __init__( + self, + *, + origin: EntityPathLike = "/", + contents: SpaceViewContentsLike = "$origin/**", + name: Utf8Like | None = None, + visible: datatypes.BoolLike | None = None, + defaults: list[Union[AsComponents, ComponentBatchLike]] = [], + overrides: dict[EntityPathLike, list[ComponentBatchLike]] = {}, + ) -> None: + """ + Construct a blueprint for a new DataframeView view. + + Parameters + ---------- + origin: + The `EntityPath` to use as the origin of this view. + All other entities will be transformed to be displayed relative to this origin. + contents: + The contents of the view specified as a query expression. + This is either a single expression, or a list of multiple expressions. + See [rerun.blueprint.archetypes.SpaceViewContents][]. + name: + The display name of the view. + visible: + Whether this view is visible. + + Defaults to true if not specified. + defaults: + List of default components or component batches to add to the space view. When an archetype + in the view is missing a component included in this set, the value of default will be used + instead of the normal fallback for the visualizer. + overrides: + Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + should be applied. The value is a list of component or component batches to apply to the entity. + + Important note: the path must be a fully qualified entity path starting at the root. The override paths + do not yet support `$origin` relative paths or glob expressions. + This will be addressed in . + + """ + + properties: dict[str, AsComponents] = {} + super().__init__( + class_identifier="Dataframe", + origin=origin, + contents=contents, + name=name, + visible=visible, + properties=properties, + defaults=defaults, + overrides=overrides, + )