Skip to main content

DataViewer::TimeSeriesDataStore

DataViewer::TimeSeriesDataStore

Centralized storage for time series data in the DataViewer widget. More…

#include <TimeSeriesDataStore.hpp>

Inherits from QObject

Public Signals

Name
void seriesAdded(QString const & key, QString const & type)
Emitted when a series is added.
void seriesRemoved(QString const & key)
Emitted when a series is removed.
void cleared()
Emitted when all series are cleared.
void layoutDirty()
Emitted when layout needs to be recomputed.

Public Functions

Name
TimeSeriesDataStore(QObject * parent =[nullptr])
~TimeSeriesDataStore() override =default
void addAnalogSeries(std::string const & key, std::shared_ptr< AnalogTimeSeries > series, std::string const & color =““)
Add an analog time series.
void addEventSeries(std::string const & key, std::shared_ptr< DigitalEventSeries > series, std::string const & color =““)
Add a digital event series.
void addIntervalSeries(std::string const & key, std::shared_ptr< DigitalIntervalSeries > series, std::string const & color =““)
Add a digital interval series.
bool removeAnalogSeries(std::string const & key)
Remove an analog time series.
bool removeEventSeries(std::string const & key)
Remove a digital event series.
bool removeIntervalSeries(std::string const & key)
Remove a digital interval series.
void clearAll()
Clear all series from the store.
std::unordered_map< std::string, AnalogSeriesEntry > const & analogSeries() const
Get the analog series map (const reference).
std::unordered_map< std::string, DigitalEventSeriesEntry > const & eventSeries() const
Get the digital event series map (const reference).
std::unordered_map< std::string, DigitalIntervalSeriesEntry > const & intervalSeries() const
Get the digital interval series map (const reference).
std::unordered_map< std::string, AnalogSeriesEntry > & analogSeriesMutable()
Get mutable reference to analog series map (for modification).
std::unordered_map< std::string, DigitalEventSeriesEntry > & eventSeriesMutable()
Get mutable reference to digital event series map.
std::unordered_map< std::string, DigitalIntervalSeriesEntry > & intervalSeriesMutable()
Get mutable reference to digital interval series map.
CorePlotting::SeriesDataCache * getAnalogDataCache(std::string const & key)
Get analog data cache for a series.
CorePlotting::SeriesDataCache const * getAnalogDataCache(std::string const & key) const
Get analog data cache for a series (const).
float computeGroupMaxStdDev(std::vector< std::string > const & keys) const
Compute the maximum standard deviation across a set of analog series.
void applyGroupStdDev(std::vector< std::string > const & keys, float group_std_dev)
Apply a unified standard deviation to a group of analog series.
void revertToIndividualScaling(std::vector< std::string > const & keys)
Revert series to their individual standard deviations.
void setSeriesOptionsRegistry(SeriesOptionsRegistry * registry)
Set the series options registry for visibility lookups.
void applyLayoutResponse(CorePlotting::LayoutResponse const & response)
Apply layout response to display options.
SeriesType findSeriesTypeByKey(std::string const & key) const
Find the type of series by key.
bool isEmpty() const
Check if any series are stored.
size_t totalSeriesCount() const
Get total count of all series.

Detailed Description

class DataViewer::TimeSeriesDataStore;

Centralized storage for time series data in the DataViewer widget.

Manages storage, addition, removal, and configuration of analog, digital event, and digital interval time series. Provides signals for change notification and integrates with the CorePlotting layout system.

Public Signals Documentation

signal seriesAdded

void seriesAdded(
    QString const & key,
    QString const & type
)

Emitted when a series is added.

Parameters:

  • key The key of the added series
  • type The type of series (“analog”, “event”, “interval”)

signal seriesRemoved

void seriesRemoved(
    QString const & key
)

Emitted when a series is removed.

Parameters:

  • key The key of the removed series

signal cleared

void cleared()

Emitted when all series are cleared.

signal layoutDirty

void layoutDirty()

Emitted when layout needs to be recomputed.

This signal is emitted when series are added/removed, indicating that the parent widget should recompute the layout.

Public Functions Documentation

function TimeSeriesDataStore

explicit TimeSeriesDataStore(
    QObject * parent =nullptr
)

function ~TimeSeriesDataStore

~TimeSeriesDataStore() override =default

function addAnalogSeries

void addAnalogSeries(
    std::string const & key,
    std::shared_ptr< AnalogTimeSeries > series,
    std::string const & color =""
)

Add an analog time series.

Parameters:

  • key Unique identifier for the series
  • series Shared pointer to the analog time series
  • color Optional hex color (e.g., “#ff0000”), empty for auto

Adds the series with display options. If no color is provided, a default color is assigned based on the current series count. Intrinsic properties (mean, std dev) are computed automatically.

function addEventSeries

void addEventSeries(
    std::string const & key,
    std::shared_ptr< DigitalEventSeries > series,
    std::string const & color =""
)

Add a digital event series.

Parameters:

  • key Unique identifier for the series
  • series Shared pointer to the digital event series
  • color Optional hex color, empty for auto

function addIntervalSeries

void addIntervalSeries(
    std::string const & key,
    std::shared_ptr< DigitalIntervalSeries > series,
    std::string const & color =""
)

Add a digital interval series.

Parameters:

  • key Unique identifier for the series
  • series Shared pointer to the digital interval series
  • color Optional hex color, empty for auto

function removeAnalogSeries

bool removeAnalogSeries(
    std::string const & key
)

Remove an analog time series.

Parameters:

  • key Key of the series to remove

Return: true if series was found and removed

function removeEventSeries

bool removeEventSeries(
    std::string const & key
)

Remove a digital event series.

Parameters:

  • key Key of the series to remove

Return: true if series was found and removed

function removeIntervalSeries

bool removeIntervalSeries(
    std::string const & key
)

Remove a digital interval series.

Parameters:

  • key Key of the series to remove

Return: true if series was found and removed

function clearAll

void clearAll()

Clear all series from the store.

Removes all analog, digital event, and digital interval series. Emits cleared() followed by individual seriesRemoved signals.

function analogSeries

std::unordered_map< std::string, AnalogSeriesEntry > const & analogSeries() const

Get the analog series map (const reference).

function eventSeries

std::unordered_map< std::string, DigitalEventSeriesEntry > const & eventSeries() const

Get the digital event series map (const reference).

function intervalSeries

std::unordered_map< std::string, DigitalIntervalSeriesEntry > const & intervalSeries() const

Get the digital interval series map (const reference).

function analogSeriesMutable

std::unordered_map< std::string, AnalogSeriesEntry > & analogSeriesMutable()

Get mutable reference to analog series map (for modification).

function eventSeriesMutable

std::unordered_map< std::string, DigitalEventSeriesEntry > & eventSeriesMutable()

Get mutable reference to digital event series map.

function intervalSeriesMutable

std::unordered_map< std::string, DigitalIntervalSeriesEntry > & intervalSeriesMutable()

Get mutable reference to digital interval series map.

function getAnalogDataCache

CorePlotting::SeriesDataCache * getAnalogDataCache(
    std::string const & key
)

Get analog data cache for a series.

Parameters:

  • key Series key

Return: Pointer to data cache, or nullptr if series not found

function getAnalogDataCache

CorePlotting::SeriesDataCache const * getAnalogDataCache(
    std::string const & key
) const

Get analog data cache for a series (const).

Parameters:

  • key Series key

Return: Pointer to data cache, or nullptr if series not found

function computeGroupMaxStdDev

float computeGroupMaxStdDev(
    std::vector< std::string > const & keys
) const

Compute the maximum standard deviation across a set of analog series.

Parameters:

  • keys Series keys to consider

Return: Maximum std_dev, or 0.0 if no valid series found

function applyGroupStdDev

void applyGroupStdDev(
    std::vector< std::string > const & keys,
    float group_std_dev
)

Apply a unified standard deviation to a group of analog series.

Parameters:

  • keys Series keys in the group
  • group_std_dev Standard deviation to use for all series

Sets cached_std_dev and intrinsic_scale for all specified series to use the provided group_std_dev instead of their individual values. The individual_std_dev field is preserved for later reversion.

function revertToIndividualScaling

void revertToIndividualScaling(
    std::vector< std::string > const & keys
)

Revert series to their individual standard deviations.

Parameters:

  • keys Series keys to revert

Restores cached_std_dev and intrinsic_scale from individual_std_dev for each specified series.

function setSeriesOptionsRegistry

void setSeriesOptionsRegistry(
    SeriesOptionsRegistry * registry
)

Set the series options registry for visibility lookups.

Parameters:

The data store needs access to the state’s series options to determine visibility when building layout requests.

function applyLayoutResponse

void applyLayoutResponse(
    CorePlotting::LayoutResponse const & response
)

Apply layout response to display options.

Parameters:

  • response Layout response from LayoutEngine::compute()

Updates each series’ display options with the computed layout (allocated_y_center, allocated_height) from the LayoutEngine.

function findSeriesTypeByKey

SeriesType findSeriesTypeByKey(
    std::string const & key
) const

Find the type of series by key.

Parameters:

  • key Series key to search for

Return: SeriesType::Analog/DigitalEvent/DigitalInterval or SeriesType::None

Searches all series maps to determine which type (if any) contains a series with the given key.

function isEmpty

bool isEmpty() const

Check if any series are stored.

Return: true if at least one series exists

function totalSeriesCount

size_t totalSeriesCount() const

Get total count of all series.

Return: Sum of analog, event, and interval series counts


Updated on 2026-11-13 at 20:25:42 +0000