Skip to main content

LinePlotState

LinePlotState

State class for LinePlotWidget. More…

#include <LinePlotState.hpp>

Inherits from EditorState, QObject

Public Signals

Name
void alignmentEventKeyChanged(QString const & key)
Emitted when alignment event key changes.
void intervalAlignmentTypeChanged(IntervalAlignmentType type)
Emitted when interval alignment type changes.
void offsetChanged(double offset)
Emitted when offset changes.
void windowSizeChanged(double window_size)
Emitted when window size changes.
void plotSeriesAdded(QString const & series_name)
Emitted when a plot series is added.
void plotSeriesRemoved(QString const & series_name)
Emitted when a plot series is removed.
void plotSeriesOptionsChanged(QString const & series_name)
Emitted when plot series options are updated.
void seriesStyleChanged(QString const & series_name)
Emitted when a series’ line style changes (via LineStyleState).
void viewStateChanged()
Emitted when view state changes (zoom, pan, or bounds).
void colorByGroupChanged()
Emitted when color_by_group changes.

Public Functions

Name
LinePlotState(QObject * parent =[nullptr])
Construct a new LinePlotState.
~LinePlotState() override =default
virtual QString getTypeName() const override
Get the type name for this state.
virtual QString getDisplayName() const override
Get the display name for UI.
virtual void setDisplayName(QString const & name) override
Set the display name.
QString getAlignmentEventKey() const
Get the alignment event key.
void setAlignmentEventKey(QString const & key)
Set the alignment event key.
IntervalAlignmentType getIntervalAlignmentType() const
Get the interval alignment type.
void setIntervalAlignmentType(IntervalAlignmentType type)
Set the interval alignment type.
double getOffset() const
Get the offset value.
void setOffset(double offset)
Set the offset value.
double getWindowSize() const
Get the window size.
void setWindowSize(double window_size)
Set the window size.
PlotAlignmentState * alignmentState()
Get the alignment state object.
RelativeTimeAxisState * relativeTimeAxisState()
Get the relative time axis state object.
VerticalAxisState * verticalAxisState()
Get the vertical axis state object.
void addPlotSeries(QString const & series_name, QString const & series_key)
Add a series to the plot.
void removePlotSeries(QString const & series_name)
Remove a series from the plot.
std::vector< QString > getPlotSeriesNames() const
Get all plot series names.
std::optional< LinePlotOptions > getPlotSeriesOptions(QString const & series_name) const
Get options for a specific plot series.
void updatePlotSeriesOptions(QString const & series_name, LinePlotOptions const & options)
Update options for a specific plot series.
LineStyleState * lineStyleStateForSeries(QString const & series_name)
Get the LineStyleState for a specific series.
CorePlotting::ViewStateData const & viewState() const
Get the current view state.
void setXZoom(double zoom)
Set X-axis zoom. Only emits viewStateChanged().
void setYZoom(double zoom)
Set Y-axis zoom. Only emits viewStateChanged().
void setPan(double x_pan, double y_pan)
Set pan offsets. Only emits viewStateChanged().
void setXBounds(double x_min, double x_max)
Set X data bounds. Emits viewStateChanged() AND stateChanged().
void setYBounds(double y_min, double y_max)
Set Y data bounds. Emits viewStateChanged() AND stateChanged().
bool colorByGroup() const
Whether lines are colored by group assignment.
void setColorByGroup(bool enabled)
Enable/disable coloring lines by group assignment.
virtual std::string toJson() const override
Serialize state to JSON.
virtual bool fromJson(std::string const & json) override
Restore state from JSON.

Additional inherited members

Public Signals inherited from EditorState

Name
void stateChanged()
Emitted when any state property changes.
void displayNameChanged(QString const & newName)
Emitted when display name changes.
void dirtyChanged(bool isDirty)
Emitted when dirty state changes.

Public Functions inherited from EditorState

Name
EditorState(QObject * parent =[nullptr])
Construct a new EditorState.
~EditorState() override =default
Virtual destructor.
QString getInstanceId() const
Get unique instance ID.
bool isDirty() const
Check if state has unsaved changes.
void markClean()
Mark state as clean (after save).

Protected Functions inherited from EditorState

Name
void markDirty()
Mark state as modified.
void setInstanceId(QString const & id)
Set instance ID (for deserialization).
QString generateInstanceId()
Generate a new unique instance ID.

Detailed Description

class LinePlotState;

State class for LinePlotWidget.

LinePlotState is the Qt wrapper around LinePlotStateData that provides typed accessors and Qt signals for all state properties.

LinePlotState uses composition with PlotAlignmentState to provide alignment functionality via the shared PlotAlignmentWidget component.

Public Signals Documentation

signal alignmentEventKeyChanged

void alignmentEventKeyChanged(
    QString const & key
)

Emitted when alignment event key changes.

Parameters:

  • key New alignment event key

signal intervalAlignmentTypeChanged

void intervalAlignmentTypeChanged(
    IntervalAlignmentType type
)

Emitted when interval alignment type changes.

Parameters:

  • type New interval alignment type

signal offsetChanged

void offsetChanged(
    double offset
)

Emitted when offset changes.

Parameters:

  • offset New offset value

signal windowSizeChanged

void windowSizeChanged(
    double window_size
)

Emitted when window size changes.

Parameters:

  • window_size New window size value

signal plotSeriesAdded

void plotSeriesAdded(
    QString const & series_name
)

Emitted when a plot series is added.

Parameters:

  • series_name Name of the added series

signal plotSeriesRemoved

void plotSeriesRemoved(
    QString const & series_name
)

Emitted when a plot series is removed.

Parameters:

  • series_name Name of the removed series

signal plotSeriesOptionsChanged

void plotSeriesOptionsChanged(
    QString const & series_name
)

Emitted when plot series options are updated.

Parameters:

  • series_name Name of the updated series

signal seriesStyleChanged

void seriesStyleChanged(
    QString const & series_name
)

Emitted when a series’ line style changes (via LineStyleState).

Parameters:

  • series_name Name of the series whose style changed

signal viewStateChanged

void viewStateChanged()

Emitted when view state changes (zoom, pan, or bounds).

signal colorByGroupChanged

void colorByGroupChanged()

Emitted when color_by_group changes.

Public Functions Documentation

function LinePlotState

explicit LinePlotState(
    QObject * parent =nullptr
)

Construct a new LinePlotState.

Parameters:

  • parent Parent QObject (typically nullptr, managed by WorkspaceManager)

function ~LinePlotState

~LinePlotState() override =default

function getTypeName

inline virtual QString getTypeName() const override

Get the type name for this state.

Return: “LinePlot”

Reimplements: EditorState::getTypeName

function getDisplayName

virtual QString getDisplayName() const override

Get the display name for UI.

Return: User-visible name (default: “Line Plot”)

Reimplements: EditorState::getDisplayName

function setDisplayName

virtual void setDisplayName(
    QString const & name
) override

Set the display name.

Parameters:

  • name New display name

Reimplements: EditorState::setDisplayName

function getAlignmentEventKey

QString getAlignmentEventKey() const

Get the alignment event key.

Return: Key of the selected event/interval series

function setAlignmentEventKey

void setAlignmentEventKey(
    QString const & key
)

Set the alignment event key.

Parameters:

  • key Key of the event/interval series to use for alignment

function getIntervalAlignmentType

IntervalAlignmentType getIntervalAlignmentType() const

Get the interval alignment type.

Return: Whether to use beginning or end of intervals

function setIntervalAlignmentType

void setIntervalAlignmentType(
    IntervalAlignmentType type
)

Set the interval alignment type.

Parameters:

  • type Whether to use beginning or end of intervals

function getOffset

double getOffset() const

Get the offset value.

Return: Offset in time units

function setOffset

void setOffset(
    double offset
)

Set the offset value.

Parameters:

  • offset Offset in time units to apply to alignment events

function getWindowSize

double getWindowSize() const

Get the window size.

Return: Window size in time units

function setWindowSize

void setWindowSize(
    double window_size
)

Set the window size.

Parameters:

  • window_size Window size in time units to gather around alignment event

function alignmentState

inline PlotAlignmentState * alignmentState()

Get the alignment state object.

Return: Pointer to the alignment state (for use with PlotAlignmentWidget)

function relativeTimeAxisState

inline RelativeTimeAxisState * relativeTimeAxisState()

Get the relative time axis state object.

Return: Pointer to the relative time axis state

function verticalAxisState

inline VerticalAxisState * verticalAxisState()

Get the vertical axis state object.

Return: Pointer to the vertical axis state

function addPlotSeries

void addPlotSeries(
    QString const & series_name,
    QString const & series_key
)

Add a series to the plot.

Parameters:

function removePlotSeries

void removePlotSeries(
    QString const & series_name
)

Remove a series from the plot.

Parameters:

  • series_name Name/key of the series to remove

function getPlotSeriesNames

std::vector< QString > getPlotSeriesNames() const

Get all plot series names.

Return: List of series names currently in the plot

function getPlotSeriesOptions

std::optional< LinePlotOptions > getPlotSeriesOptions(
    QString const & series_name
) const

Get options for a specific plot series.

Parameters:

  • series_name Name/key of the series

Return: Options struct, or std::nullopt if series not found

function updatePlotSeriesOptions

void updatePlotSeriesOptions(
    QString const & series_name,
    LinePlotOptions const & options
)

Update options for a specific plot series.

Parameters:

  • series_name Name/key of the series
  • options New options

function lineStyleStateForSeries

LineStyleState * lineStyleStateForSeries(
    QString const & series_name
)

Get the LineStyleState for a specific series.

Parameters:

  • series_name Name/key of the series

Return: LineStyleState pointer, or nullptr if series not found

The returned state is owned by this LinePlotState and shares lifetime with the series. Use with LineStyleControls::setLineStyleState().

function viewState

inline CorePlotting::ViewStateData const & viewState() const

Get the current view state.

function setXZoom

void setXZoom(
    double zoom
)

Set X-axis zoom. Only emits viewStateChanged().

function setYZoom

void setYZoom(
    double zoom
)

Set Y-axis zoom. Only emits viewStateChanged().

function setPan

void setPan(
    double x_pan,
    double y_pan
)

Set pan offsets. Only emits viewStateChanged().

function setXBounds

void setXBounds(
    double x_min,
    double x_max
)

Set X data bounds. Emits viewStateChanged() AND stateChanged().

function setYBounds

void setYBounds(
    double y_min,
    double y_max
)

Set Y data bounds. Emits viewStateChanged() AND stateChanged().

function colorByGroup

inline bool colorByGroup() const

Whether lines are colored by group assignment.

function setColorByGroup

void setColorByGroup(
    bool enabled
)

Enable/disable coloring lines by group assignment.

function toJson

virtual std::string toJson() const override

Serialize state to JSON.

Return: JSON string representation

Reimplements: EditorState::toJson

function fromJson

virtual bool fromJson(
    std::string const & json
) override

Restore state from JSON.

Parameters:

  • json JSON string to parse

Return: true if parsing succeeded

Reimplements: EditorState::fromJson


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