Rerun C++ SDK
Loading...
Searching...
No Matches
series_line.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/store/re_types/definitions/rerun/archetypes/series_line.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../components/aggregation_policy.hpp"
10#include "../components/color.hpp"
11#include "../components/name.hpp"
12#include "../components/stroke_width.hpp"
13#include "../indicator_component.hpp"
14#include "../result.hpp"
15
16#include <cstdint>
17#include <optional>
18#include <utility>
19#include <vector>
20
21namespace rerun::archetypes {
22 /// **Archetype**: Define the style properties for a line series in a chart.
23 ///
24 /// This archetype only provides styling information and should be logged as static
25 /// when possible. The underlying data needs to be logged to the same entity-path using
26 /// `archetypes::Scalar`.
27 ///
28 /// ## Example
29 ///
30 /// ### Line series
31 /// ![image](https://static.rerun.io/series_line_style/d2616d98b1e46bdb85849b8669154fdf058e3453/full.png)
32 ///
33 /// ```cpp
34 /// #include <rerun.hpp>
35 ///
36 /// #include <cmath>
37 ///
38 /// constexpr float TAU = 6.28318530717958647692528676655900577f;
39 ///
40 /// int main() {
41 /// const auto rec = rerun::RecordingStream("rerun_example_series_line_style");
42 /// rec.spawn().exit_on_failure();
43 ///
44 /// // Set up plot styling:
45 /// // They are logged static as they don't change over time and apply to all timelines.
46 /// // Log two lines series under a shared root so that they show in the same plot by default.
47 /// rec.log_static(
48 /// "trig/sin",
49 /// rerun::SeriesLine().with_color({255, 0, 0}).with_name("sin(0.01t)").with_width(2)
50 /// );
51 /// rec.log_static(
52 /// "trig/cos",
53 /// rerun::SeriesLine().with_color({0, 255, 0}).with_name("cos(0.01t)").with_width(4)
54 /// );
55 ///
56 /// // Log the data on a timeline called "step".
57 /// for (int t = 0; t <static_cast<int>(TAU * 2.0 * 100.0); ++t) {
58 /// rec.set_time_sequence("step", t);
59 ///
60 /// rec.log("trig/sin", rerun::Scalar(sin(static_cast<double>(t) / 100.0)));
61 /// rec.log("trig/cos", rerun::Scalar(cos(static_cast<double>(t) / 100.0f)));
62 /// }
63 /// }
64 /// ```
65 struct SeriesLine {
66 /// Color for the corresponding series.
67 std::optional<rerun::components::Color> color;
68
69 /// Stroke width for the corresponding series.
70 std::optional<rerun::components::StrokeWidth> width;
71
72 /// Display name of the series.
73 ///
74 /// Used in the legend.
75 std::optional<rerun::components::Name> name;
76
77 /// Configures the zoom-dependent scalar aggregation.
78 ///
79 /// This is done only if steps on the X axis go below a single pixel,
80 /// i.e. a single pixel covers more than one tick worth of data. It can greatly improve performance
81 /// (and readability) in such situations as it prevents overdraw.
82 std::optional<rerun::components::AggregationPolicy> aggregation_policy;
83
84 public:
85 static constexpr const char IndicatorComponentName[] =
86 "rerun.components.SeriesLineIndicator";
87
88 /// Indicator component, used to identify the archetype when converting to a list of components.
90
91 public:
92 SeriesLine() = default;
93 SeriesLine(SeriesLine&& other) = default;
94
95 /// Color for the corresponding series.
97 color = std::move(_color);
98 // See: https://github.com/rerun-io/rerun/issues/4027
99 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
100 }
101
102 /// Stroke width for the corresponding series.
104 width = std::move(_width);
105 // See: https://github.com/rerun-io/rerun/issues/4027
106 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
107 }
108
109 /// Display name of the series.
110 ///
111 /// Used in the legend.
113 name = std::move(_name);
114 // See: https://github.com/rerun-io/rerun/issues/4027
115 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
116 }
117
118 /// Configures the zoom-dependent scalar aggregation.
119 ///
120 /// This is done only if steps on the X axis go below a single pixel,
121 /// i.e. a single pixel covers more than one tick worth of data. It can greatly improve performance
122 /// (and readability) in such situations as it prevents overdraw.
124 ) && {
125 aggregation_policy = std::move(_aggregation_policy);
126 // See: https://github.com/rerun-io/rerun/issues/4027
127 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
128 }
129 };
130
131} // namespace rerun::archetypes
132
133namespace rerun {
134 /// \private
135 template <typename T>
136 struct AsComponents;
137
138 /// \private
139 template <>
140 struct AsComponents<archetypes::SeriesLine> {
141 /// Serialize all set component batches.
142 static Result<std::vector<ComponentBatch>> serialize(const archetypes::SeriesLine& archetype
143 );
144 };
145} // namespace rerun
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:76
AggregationPolicy
Component: Policy for aggregation of multiple scalar plot values.
Definition aggregation_policy.hpp:28
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Archetype: Define the style properties for a line series in a chart.
Definition series_line.hpp:65
SeriesLine with_name(rerun::components::Name _name) &&
Display name of the series.
Definition series_line.hpp:112
SeriesLine with_width(rerun::components::StrokeWidth _width) &&
Stroke width for the corresponding series.
Definition series_line.hpp:103
std::optional< rerun::components::Name > name
Display name of the series.
Definition series_line.hpp:75
std::optional< rerun::components::StrokeWidth > width
Stroke width for the corresponding series.
Definition series_line.hpp:70
std::optional< rerun::components::AggregationPolicy > aggregation_policy
Configures the zoom-dependent scalar aggregation.
Definition series_line.hpp:82
SeriesLine with_aggregation_policy(rerun::components::AggregationPolicy _aggregation_policy) &&
Configures the zoom-dependent scalar aggregation.
Definition series_line.hpp:123
std::optional< rerun::components::Color > color
Color for the corresponding series.
Definition series_line.hpp:67
SeriesLine with_color(rerun::components::Color _color) &&
Color for the corresponding series.
Definition series_line.hpp:96
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:17
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:30
Component: A display name, typically for an entity or a item like a plot series.
Definition name.hpp:16
Component: The width of a stroke specified in UI points.
Definition stroke_width.hpp:14