Skip to main content

ScatterPlotState

ScatterPlotState

State class for ScatterPlotWidget. More…

#include <ScatterPlotState.hpp>

Inherits from EditorState, QObject

Public Signals

Name
void viewStateChanged()
void xSourceChanged()
void ySourceChanged()
void referenceLineChanged()
void colorByGroupChanged()
void clusterLabelsChanged()
void glyphStyleChanged()
void selectionModeChanged()
void selectionChanged()
void colorConfigChanged()
void backgroundColorChanged(QString const & hex_color)
Emitted when the plot background color changes.

Public Functions

Name
ScatterPlotState(QObject * parent =[nullptr])
~ScatterPlotState() override
virtual QString getTypeName() const override
Get unique type name for this editor state.
virtual QString getDisplayName() const override
Get display name for UI.
virtual void setDisplayName(QString const & name) override
Set display name.
QString getBackgroundColor() const
Get the plot background color (#RRGGBB).
void setBackgroundColor(QString const & hex_color)
Set the plot background color (#RRGGBB).
HorizontalAxisState * horizontalAxisState()
VerticalAxisState * verticalAxisState()
CorePlotting::ViewStateData const & viewState() const
Get the current view state (zoom, pan, data bounds).
void setXZoom(double zoom)
void setYZoom(double zoom)
void setPan(double x_pan, double y_pan)
void setXBounds(double x_min, double x_max)
Set X data bounds; updates view state and horizontal axis.
void setYBounds(double y_min, double y_max)
Set Y data bounds; updates view state and vertical axis.
std::optional< ScatterAxisSource > const & xSource() const
std::optional< ScatterAxisSource > const & ySource() const
void setXSource(std::optional< ScatterAxisSource > source)
void setYSource(std::optional< ScatterAxisSource > source)
bool showReferenceLine() const
void setShowReferenceLine(bool show)
bool colorByGroup() const
void setColorByGroup(bool enabled)
bool showClusterLabels() const
void setShowClusterLabels(bool enabled)
ScatterSelectionMode selectionMode() const
void setSelectionMode(ScatterSelectionMode mode)
std::vector< std::size_t > const & selectedIndices() const
void setSelectedIndices(std::vector< std::size_t > indices)
void addSelectedIndex(std::size_t index)
void removeSelectedIndex(std::size_t index)
void clearSelection()
bool isSelected(std::size_t index) const
GlyphStyleState * glyphStyleState()
Get glyph style state (for GlyphStyleControls binding).
ScatterColorConfigData const & colorConfig() const
void setColorConfig(ScatterColorConfigData config)
virtual std::string toJson() const override
Serialize state to JSON string.
virtual bool fromJson(std::string const & json) override
Restore state from JSON string.

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 ScatterPlotState;

State class for ScatterPlotWidget.

Single source of truth: view_state (zoom/pan) plus horizontal and vertical axis states (full range). OpenGL widget and axis widgets read from state.

Public Signals Documentation

signal viewStateChanged

void viewStateChanged()

signal xSourceChanged

void xSourceChanged()

signal ySourceChanged

void ySourceChanged()

signal referenceLineChanged

void referenceLineChanged()

signal colorByGroupChanged

void colorByGroupChanged()

signal clusterLabelsChanged

void clusterLabelsChanged()

signal glyphStyleChanged

void glyphStyleChanged()

signal selectionModeChanged

void selectionModeChanged()

signal selectionChanged

void selectionChanged()

signal colorConfigChanged

void colorConfigChanged()

signal backgroundColorChanged

void backgroundColorChanged(
    QString const & hex_color
)

Emitted when the plot background color changes.

Parameters:

  • hex_color New background color as hex string

Public Functions Documentation

function ScatterPlotState

explicit ScatterPlotState(
    QObject * parent =nullptr
)

function ~ScatterPlotState

~ScatterPlotState() override

function getTypeName

inline virtual QString getTypeName() const override

Get unique type name for this editor state.

Return: Type name, e.g., “MediaWidget”, “DataViewerWidget”

Reimplements: EditorState::getTypeName

This is used for:

  • Factory registration
  • Serialization type field
  • Properties panel routing

function getDisplayName

virtual QString getDisplayName() const override

Get display name for UI.

Return: Display name, e.g., “Media Viewer 1”

Reimplements: EditorState::getDisplayName

This is the user-visible name shown in tabs, window titles, etc. It may be customized by the user.

function setDisplayName

virtual void setDisplayName(
    QString const & name
) override

Set display name.

Parameters:

  • name New display name

Reimplements: EditorState::setDisplayName

function getBackgroundColor

QString getBackgroundColor() const

Get the plot background color (#RRGGBB).

function setBackgroundColor

void setBackgroundColor(
    QString const & hex_color
)

Set the plot background color (#RRGGBB).

function horizontalAxisState

HorizontalAxisState * horizontalAxisState()

function verticalAxisState

VerticalAxisState * verticalAxisState()

function viewState

inline CorePlotting::ViewStateData const & viewState() const

Get the current view state (zoom, pan, data bounds).

function setXZoom

void setXZoom(
    double zoom
)

function setYZoom

void setYZoom(
    double zoom
)

function setPan

void setPan(
    double x_pan,
    double y_pan
)

function setXBounds

void setXBounds(
    double x_min,
    double x_max
)

Set X data bounds; updates view state and horizontal axis.

function setYBounds

void setYBounds(
    double y_min,
    double y_max
)

Set Y data bounds; updates view state and vertical axis.

function xSource

inline std::optional< ScatterAxisSource > const & xSource() const

function ySource

inline std::optional< ScatterAxisSource > const & ySource() const

function setXSource

void setXSource(
    std::optional< ScatterAxisSource > source
)

function setYSource

void setYSource(
    std::optional< ScatterAxisSource > source
)

function showReferenceLine

inline bool showReferenceLine() const

function setShowReferenceLine

void setShowReferenceLine(
    bool show
)

function colorByGroup

inline bool colorByGroup() const

function setColorByGroup

void setColorByGroup(
    bool enabled
)

function showClusterLabels

inline bool showClusterLabels() const

function setShowClusterLabels

void setShowClusterLabels(
    bool enabled
)

function selectionMode

ScatterSelectionMode selectionMode() const

function setSelectionMode

void setSelectionMode(
    ScatterSelectionMode mode
)

function selectedIndices

inline std::vector< std::size_t > const & selectedIndices() const

function setSelectedIndices

void setSelectedIndices(
    std::vector< std::size_t > indices
)

function addSelectedIndex

void addSelectedIndex(
    std::size_t index
)

function removeSelectedIndex

void removeSelectedIndex(
    std::size_t index
)

function clearSelection

void clearSelection()

function isSelected

bool isSelected(
    std::size_t index
) const

function glyphStyleState

GlyphStyleState * glyphStyleState()

Get glyph style state (for GlyphStyleControls binding).

function colorConfig

inline ScatterColorConfigData const & colorConfig() const

function setColorConfig

void setColorConfig(
    ScatterColorConfigData config
)

function toJson

virtual std::string toJson() const override

Serialize state to JSON string.

Return: JSON string representation of state

Reimplements: EditorState::toJson

Subclasses should use reflect-cpp for serialization: ```cpp

std::string toJson() const override { return rfl::json::write(_data); }



### function fromJson

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

Restore state from JSON string.

Parameters:

  • json JSON string to parse

Return: true if parsing succeeded, false on error

Reimplements: EditorState::fromJson

Subclasses should use reflect-cpp for deserialization: ```cpp

bool fromJson(std::string const& json) override { auto result = rfl::json::read(json); if (result) { _data = *result; emit stateChanged(); return true; } return false; } ```


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