11 #include <RADUi/RADUi.h>
77 std::vector<PlotSeriesSnapshot>
series;
194 void append(
size_t seriesIndex,
double x,
double y);
198 void appendBatch(
size_t seriesIndex,
const std::vector<PlotPoint>& points);
231 std::unique_ptr<Impl> pImpl_;
252 std::array<std::shared_ptr<PlotModel>, 4> panels_;
273 PlotColor grid_{55, 65, 75, 255};
274 PlotColor axis_{150, 160, 170, 255};
#define RAD_EVENT(Name, Signature)
Declares a typed RADCore event; example: RAD_EVENT(done, (int)).
Definition: RADCore.h:97
#define RADEvents
Marks a public event declaration block in RADObject-derived classes.
Definition: RADCore.h:75
Base class for event receivers, senders, and thread-affinity aware objects.
Definition: RADCore.h:963
OpenGL renderer facade with software fallback.
Definition: RADPlot.h:278
PlotImage render(const PlotModelSnapshot &snapshot, const PlotViewport &viewport) override
Renders with OpenGL when implemented, otherwise delegates to software.
Mutable X/Y plot data model that emits dataChanged on edits.
Definition: RADPlot.h:173
~PlotModel() override
Destroys the model implementation.
PlotModel()
Creates an empty plot model.
void setAutoRange(bool enabled)
Enables or disables automatic range calculation.
void setXRange(PlotRange range)
Sets the manual X-axis range.
void setSeriesStyle(size_t seriesIndex, PlotSeriesStyle style)
Updates the rendering style for one series.
size_t maxPointCount() const
Returns the maximum retained points per series.
void setYRange(PlotRange range)
Sets the manual Y-axis range.
void setRollingXWindow(double width)
Sets a rolling X-axis window width; 0 disables rolling range.
bool autoRange() const
Returns true when ranges are calculated from data.
PlotRange yRange() const
Returns the current Y-axis range.
PlotModelSnapshot snapshot() const
Returns an immutable model snapshot for rendering.
size_t addSeries(std::string name, PlotSeriesStyle style={})
Adds a named series and returns its index.
RADCore::Event< void() > dataChanged
Raised when series data, ranges, or styles change.
Definition: RADPlot.h:177
void clear()
Removes all series data.
double rollingXWindow() const
Returns the rolling X-axis window width.
void appendBatch(size_t seriesIndex, const std::vector< PlotPoint > &points)
Appends a batch of points to a series.
void append(size_t seriesIndex, double x, double y)
Appends one X/Y point to a series.
size_t seriesCount() const
Returns the number of series in the model.
void setMaxPointCount(size_t maxPointCount)
Sets the maximum retained points per series; 0 means unlimited.
PlotRange xRange() const
Returns the current X-axis range.
void clearSeries(size_t seriesIndex)
Removes all points from one series.
void append(size_t seriesIndex, PlotPoint point)
Appends one point to a series.
Abstract renderer that converts plot snapshots into images.
Definition: RADPlot.h:256
virtual PlotImage render(const PlotModelSnapshot &snapshot, const PlotViewport &viewport)=0
Renders snapshot into an image using viewport.
virtual ~PlotRenderer()=default
Destroys renderer implementations through the base class.
Four-panel plot model for I/Q, quad, or dashboard-style views.
Definition: RADPlot.h:235
const PlotModel & panel(size_t index) const
Returns a const panel by index 0..3.
PlotModel & panel(size_t index)
Returns a mutable panel by index 0..3.
QuadPlotModel()
Creates four empty panels.
void setMaxPointCount(size_t maxPointCount)
Applies a shared max point count to all panels.
void setSharedRollingXWindow(double width)
Applies a shared rolling X window to all panels.
void clear()
Clears all panels.
CPU renderer used by examples and as the OpenGL fallback.
Definition: RADPlot.h:265
PlotImage render(const PlotModelSnapshot &snapshot, const PlotViewport &viewport) override
Renders the plot entirely on the CPU.
Definition: RADAppKit.h:20
std::unique_ptr< PlotRenderer > createPlotRenderer(PlotRenderMode mode)
Creates a renderer for mode.
PlotAxisFormat
X-axis label formatting mode.
Definition: RADPlot.h:87
@ Numeric
Render values as plain numbers.
@ SecondsMilliseconds
Render values as seconds plus milliseconds.
@ LogFrequencyHz
Render values as a log10(Hz) coordinate labeled in Hz or kHz.
PlotTickMode
X-axis tick placement mode.
Definition: RADPlot.h:97
@ EvenlySpaced
Distribute ticks evenly across the viewport.
@ FixedInterval
Place ticks on fixed intervals in model units.
PlotAxisLabelMode
X-axis label value interpretation.
Definition: RADPlot.h:105
@ AxisValue
Labels show actual axis values.
@ WindowRelative
Labels show values relative to the current visible window.
PlotRenderMode
Renderer implementation selection.
Definition: RADPlot.h:165
@ Software
CPU software renderer.
@ OpenGL
OpenGL renderer when available, with software fallback.
RGBA color used by plot renderers.
Definition: RADPlot.h:33
uint8_t g
Green component.
Definition: RADPlot.h:37
uint8_t a
Alpha component.
Definition: RADPlot.h:41
uint8_t b
Blue component.
Definition: RADPlot.h:39
uint8_t r
Red component.
Definition: RADPlot.h:35
RGBA image returned by plot renderers.
Definition: RADPlot.h:155
int width
Image width in pixels.
Definition: RADPlot.h:157
std::vector< PlotPixel > pixels
Pixel buffer in row-major order.
Definition: RADPlot.h:161
int height
Image height in pixels.
Definition: RADPlot.h:159
Immutable copy of a complete plot model.
Definition: RADPlot.h:75
PlotRange yRange
Y-axis range used for rendering.
Definition: RADPlot.h:81
std::vector< PlotSeriesSnapshot > series
Series included in the snapshot.
Definition: RADPlot.h:77
PlotRange xRange
X-axis range used for rendering.
Definition: RADPlot.h:79
bool hasData
True when at least one point exists.
Definition: RADPlot.h:83
One output pixel.
Definition: RADPlot.h:143
uint8_t b
Blue component.
Definition: RADPlot.h:149
uint8_t a
Alpha component.
Definition: RADPlot.h:151
uint8_t r
Red component.
Definition: RADPlot.h:145
uint8_t g
Green component.
Definition: RADPlot.h:147
One X/Y sample in plot coordinate space.
Definition: RADPlot.h:25
double y
Vertical coordinate.
Definition: RADPlot.h:29
double x
Horizontal coordinate.
Definition: RADPlot.h:27
Inclusive numeric range for an axis.
Definition: RADPlot.h:45
double max
Maximum axis value.
Definition: RADPlot.h:49
double min
Minimum axis value.
Definition: RADPlot.h:47
Immutable copy of one series for renderer consumption.
Definition: RADPlot.h:65
std::string name
Display name for the series.
Definition: RADPlot.h:67
PlotSeriesStyle style
Rendering style copied from the model.
Definition: RADPlot.h:69
std::vector< PlotPoint > points
Series points copied from the model.
Definition: RADPlot.h:71
Rendering style for one plot series.
Definition: RADPlot.h:53
bool drawPoints
Draw discrete sample points.
Definition: RADPlot.h:61
int lineWidth
Line width in pixels for software rendering.
Definition: RADPlot.h:57
bool drawLines
Draw connected line segments.
Definition: RADPlot.h:59
PlotColor color
Series color.
Definition: RADPlot.h:55
Pixel viewport and axis rendering configuration.
Definition: RADPlot.h:113
int width
Output image width in pixels.
Definition: RADPlot.h:115
bool drawXAxisLabels
Draw X-axis text labels.
Definition: RADPlot.h:131
PlotAxisLabelMode xAxisLabelMode
X-axis label value mode.
Definition: RADPlot.h:139
PlotTickMode xTickMode
X-axis tick placement mode.
Definition: RADPlot.h:135
int yTickCount
Target number of Y-axis ticks.
Definition: RADPlot.h:129
double xTickInterval
Fixed interval used when xTickMode is FixedInterval.
Definition: RADPlot.h:137
PlotAxisFormat xAxisFormat
X-axis label formatting.
Definition: RADPlot.h:133
int leftMargin
Left margin reserved for labels.
Definition: RADPlot.h:119
int topMargin
Top margin in pixels.
Definition: RADPlot.h:123
int height
Output image height in pixels.
Definition: RADPlot.h:117
int xTickCount
Target number of X-axis ticks.
Definition: RADPlot.h:127
int bottomMargin
Bottom margin reserved for labels.
Definition: RADPlot.h:125
int rightMargin
Right margin in pixels.
Definition: RADPlot.h:121