Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::BarChart Struct Reference

Archetype: A bar chart. More...

#include <rerun/archetypes/bar_chart.hpp>

Public Member Functions

 BarChart (rerun::datatypes::TensorBuffer buffer)
 
 BarChart (Collection< uint8_t > u8)
 Construct a BarChart from a Collection<uint8_t>.
 
 BarChart (Collection< uint16_t > u16)
 Construct a BarChart from a Collection<uint16_t>.
 
 BarChart (Collection< uint32_t > u32)
 Construct a BarChart from a Collection<uint32_t>.
 
 BarChart (Collection< uint64_t > u64)
 Construct a BarChart from a Collection<uint64_t>.
 
 BarChart (Collection< int8_t > i8)
 Construct a BarChart from a Collection<int8_t>.
 
 BarChart (Collection< int16_t > i16)
 Construct a BarChart from a Collection<int16_t>.
 
 BarChart (Collection< int32_t > i32)
 Construct a BarChart from a Collection<int32_t>.
 
 BarChart (Collection< int64_t > i64)
 Construct a BarChart from a Collection<int64_t>.
 
 BarChart (Collection< rerun::half > f16)
 Construct aBarChartfrom aCollection<half>`.
 
 BarChart (Collection< float > f32)
 Construct a BarChart from a Collection<float>.
 
 BarChart (Collection< double > f64)
 Construct a BarChart from a Collection<double>.
 
 BarChart (BarChart &&other)=default
 
 BarChart (const BarChart &other)=default
 
BarChartoperator= (const BarChart &other)=default
 
BarChartoperator= (BarChart &&other)=default
 
 BarChart (rerun::components::TensorData _values)
 
BarChart with_values (const rerun::components::TensorData &_values) &&
 The values. Should always be a 1-dimensional tensor (i.e. a vector).
 
BarChart with_many_values (const Collection< rerun::components::TensorData > &_values) &&
 This method makes it possible to pack multiple values in a single component batch.
 
BarChart with_color (const rerun::components::Color &_color) &&
 The color of the bar chart.
 
BarChart with_many_color (const Collection< rerun::components::Color > &_color) &&
 This method makes it possible to pack multiple color in a single component batch.
 
BarChart with_abscissa (const rerun::components::TensorData &_abscissa) &&
 The abscissa corresponding to each value. Should be a 1-dimensional tensor (i.e. a vector) in same length as values.
 
BarChart with_many_abscissa (const Collection< rerun::components::TensorData > &_abscissa) &&
 This method makes it possible to pack multiple abscissa in a single component batch.
 
Collection< ComponentColumncolumns (const Collection< uint32_t > &lengths_)
 Partitions the component data into multiple sub-batches.
 
Collection< ComponentColumncolumns ()
 Partitions the component data into unit-length sub-batches.
 

Static Public Member Functions

static BarChart u8 (Collection< uint8_t > u8)
 Construct a BarChart from a Collection<uint8_t>.
 
static BarChart u16 (Collection< uint16_t > u16)
 Construct a BarChart from a Collection<uint16_t>.
 
static BarChart u32 (Collection< uint32_t > u32)
 Construct a BarChart from a Collection<uint32_t>.
 
static BarChart u64 (Collection< uint64_t > u64)
 Construct a BarChart from a Collection<uint64_t>.
 
static BarChart i8 (Collection< int8_t > i8)
 Construct a BarChart from a Collection<int8_t>.
 
static BarChart i16 (Collection< int16_t > i16)
 Construct a BarChart from a Collection<int16_t>.
 
static BarChart i32 (Collection< int32_t > i32)
 Construct a BarChart from a Collection<int32_t>.
 
static BarChart i64 (Collection< int64_t > i64)
 Construct a BarChart from a Collection<int64_t>.
 
static BarChart f16 (Collection< rerun::half > f16)
 Construct a BarChart from a Collection<half>.
 
static BarChart f32 (Collection< float > f32)
 Construct a BarChart from a Collection<float>.
 
static BarChart f64 (Collection< double > f64)
 Construct a BarChart from a Collection<double>.
 
static BarChart update_fields ()
 Update only some specific fields of a BarChart.
 
static BarChart clear_fields ()
 Clear all the fields of a BarChart.
 

Public Attributes

std::optional< ComponentBatchvalues
 The values. Should always be a 1-dimensional tensor (i.e. a vector).
 
std::optional< ComponentBatchcolor
 The color of the bar chart.
 
std::optional< ComponentBatchabscissa
 The abscissa corresponding to each value. Should be a 1-dimensional tensor (i.e. a vector) in same length as values.
 

Static Public Attributes

static constexpr const char ArchetypeName [] = "rerun.archetypes.BarChart"
 The name of the archetype as used in ComponentDescriptors.
 
static constexpr auto Descriptor_values
 ComponentDescriptor for the values field.
 
static constexpr auto Descriptor_color
 ComponentDescriptor for the color field.
 
static constexpr auto Descriptor_abscissa
 ComponentDescriptor for the abscissa field.
 

Detailed Description

Archetype: A bar chart.

The bar heights will be the provided values, and the x coordinates of the bars will be the provided abscissa or default to the index of the provided values.

Example

Simple bar chart

image

#include <rerun.hpp>
#include <vector>
int main() {
const auto rec = rerun::RecordingStream("rerun_example_bar_chart");
rec.spawn().exit_on_failure();
rec.log("bar_chart", rerun::BarChart::i64({8, 4, 0, 9, 1, 4, 1, 6, 9, 0}));
auto abscissa = std::vector<int64_t>{0, 1, 3, 4, 7, 11};
auto abscissa_data = rerun::TensorData(rerun::Collection{abscissa.size()}, abscissa);
rec.log(
"bar_chart_custom_abscissa",
rerun::BarChart::i64({8, 4, 0, 9, 1, 4}).with_abscissa(abscissa_data)
);
}
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:62
std::optional< ComponentBatch > abscissa
The abscissa corresponding to each value. Should be a 1-dimensional tensor (i.e. a vector) in same le...
Definition bar_chart.hpp:54
BarChart with_abscissa(const rerun::components::TensorData &_abscissa) &&
The abscissa corresponding to each value. Should be a 1-dimensional tensor (i.e. a vector) in same le...
Definition bar_chart.hpp:242
Datatype: An N-dimensional array of numbers.
Definition tensor_data.hpp:30

Member Function Documentation

◆ with_many_values()

BarChart rerun::archetypes::BarChart::with_many_values ( const Collection< rerun::components::TensorData > &  _values) &&
inline

This method makes it possible to pack multiple values in a single component batch.

This only makes sense when used in conjunction with columns. with_values should be used when logging a single row's worth of data.

◆ with_many_color()

BarChart rerun::archetypes::BarChart::with_many_color ( const Collection< rerun::components::Color > &  _color) &&
inline

This method makes it possible to pack multiple color in a single component batch.

This only makes sense when used in conjunction with columns. with_color should be used when logging a single row's worth of data.

◆ with_many_abscissa()

BarChart rerun::archetypes::BarChart::with_many_abscissa ( const Collection< rerun::components::TensorData > &  _abscissa) &&
inline

This method makes it possible to pack multiple abscissa in a single component batch.

This only makes sense when used in conjunction with columns. with_abscissa should be used when logging a single row's worth of data.

◆ columns() [1/2]

Collection< ComponentColumn > rerun::archetypes::BarChart::columns ( const Collection< uint32_t > &  lengths_)

Partitions the component data into multiple sub-batches.

Specifically, this transforms the existing ComponentBatch data into ComponentColumns instead, via ComponentBatch::partitioned.

This makes it possible to use RecordingStream::send_columns to send columnar data directly into Rerun.

The specified lengths must sum to the total length of the component batch.

◆ columns() [2/2]

Collection< ComponentColumn > rerun::archetypes::BarChart::columns ( )

Partitions the component data into unit-length sub-batches.

This is semantically similar to calling columns with std::vector<uint32_t>(n, 1), where n is automatically guessed.

Member Data Documentation

◆ Descriptor_values

constexpr auto rerun::archetypes::BarChart::Descriptor_values
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "BarChart:values", Loggable<rerun::components::TensorData>::ComponentType
)
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition bar_chart.hpp:58

ComponentDescriptor for the values field.

◆ Descriptor_color

constexpr auto rerun::archetypes::BarChart::Descriptor_color
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "BarChart:color", Loggable<rerun::components::Color>::ComponentType
)

ComponentDescriptor for the color field.

◆ Descriptor_abscissa

constexpr auto rerun::archetypes::BarChart::Descriptor_abscissa
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "BarChart:abscissa",
Loggable<rerun::components::TensorData>::ComponentType
)

ComponentDescriptor for the abscissa field.


The documentation for this struct was generated from the following file: