NDEVR
API Documentation
NDEVRChartModel.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Model.h>
4#include <NDEVR/Font.h>
5namespace NDEVR
6{
7 class StationModel;
16 class NDEVR_DESIGN_API NDEVRChartModel : public Model
17 {
18 public:
25 struct NDEVR_DESIGN_API CursorAppearance
26 {
27 CursorAppearance();
29 RGBColor indicator_color = RGBColor(128, 128, 128, 128);
30 RGBColor line_color = RGBColor(128, 128, 128, 128);
32 };
33
36 struct NDEVR_DESIGN_API SeriesAppearance
37 {
38 RGBColor color = Constant<RGBColor>::Invalid;
41 };
42
46 struct NDEVR_DESIGN_API BackgroundAppearance
47 {
48 BackgroundAppearance();
53 void setupScale(Ray<3, fltp08> desired_size);
59 void setupMajorSpacing(const Vertex<3, uint04>& dash_count, bool make_pretty_numbers);
63 Ray<3, fltp08> major_spacing = Ray<3, fltp08>(5.0);
65 Ray<3, fltp08> axis_scale = Ray<3, fltp08>(1.0);
66 RGBColor major_color = RGBColor(128, 128, 128);
67 RGBColor minor_color = RGBColor(128, 128, 128, 128);
71 };
72
80
88 NDEVRChartModel(const Model& model);
89
95 void addSeries(const StringView& series_name, ChartType type);
103 void appendToSeries(const StringView& series_name, Vertex<3, fltp08> vertex, bool auto_adjust_bounds = true, bool auto_adjust_cursor = true);
111 void appendToSeries(const StringView& series_name, const Buffer<Vertex<3, fltp08>>& vertices, bool auto_adjust_bounds = true, bool auto_adjust_cursor = true);
119 void combineIntoSingleSeries(const StringView& series_name, const StringView& series_to_append);
129 void clearSeries(const StringView& series_name);
135 Model getSeries(const StringView& series_name) const;
141 Model getCursor(const StringView& series_name) const;
148 Model createCursor(const StringView& series_name, const CursorAppearance& apperance);
154 void setSeriesAppearance(const StringView& series_name, const SeriesAppearance& appearance);
192 public:
197 static constexpr StringView TypeName() { return "chart"; }
198 protected:
205 void updateCursor(const StringView& series_name, const Vertex<3, fltp08>& datapoint, const Bounds<3, fltp08>& bounds);
214 void init();
216 };
217}
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:54
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Information for how to display text data.
Definition Font.h:46
Container responsible for storing and setting the appearance of a Model or Geometry within the NDEVR ...
Definition Material.h:153
Model()
Default constructor. Creates an uninitialized Model.
Definition Model.h:365
Model seriesContainer() const
Retrieves the container Model that holds all data series.
void init()
Initializes the chart model's internal structure (series container, cursor container,...
void combineIntoSingleSeries(const StringView &series_name, const StringView &series_to_append)
Merges data from one series into another, combining them into a single series.
void setBackgroundAppearance(const BackgroundAppearance &appearance)
Applies background appearance settings (grid, fonts, colors, title).
Model getCursor(const StringView &series_name) const
Retrieves the Model representing a cursor for a named series.
const BackgroundAppearance & backgroundAppearance() const
Retrieves the current background appearance settings.
void appendToSeries(const StringView &series_name, Vertex< 3, fltp08 > vertex, bool auto_adjust_bounds=true, bool auto_adjust_cursor=true)
Appends a single data point to a named series.
void addSeries(const StringView &series_name, ChartType type)
Adds a new named data series to the chart.
void setSeriesAppearance(const StringView &series_name, const SeriesAppearance &appearance)
Sets the visual appearance of a named data series.
NDEVRChartModel(const Model &model)
Constructs a chart model by wrapping an existing Model.
void updateCursor(const StringView &series_name, const Vertex< 3, fltp08 > &datapoint, const Bounds< 3, fltp08 > &bounds)
Updates the cursor position for a named series based on a data point.
void appendToSeries(const StringView &series_name, const Buffer< Vertex< 3, fltp08 > > &vertices, bool auto_adjust_bounds=true, bool auto_adjust_cursor=true)
Appends multiple data points to a named series.
static constexpr StringView TypeName()
Returns the type name identifier for chart models.
UUID backgroundLineID() const
Retrieves the UUID of the background grid line geometry.
Material seriesMaterial()
Retrieves or creates the shared Material used for rendering series geometry.
NDEVRChartModel()
Constructs a default, empty chart model.
ChartType
Enumerates the supported chart visualization types.
@ e_line_chart
A line chart where data points are connected by lines.
@ e_scatter
A scatter plot where data points are drawn as individual markers.
BackgroundAppearance m_background_appearance
The cached background appearance settings.
void clearSeries(const StringView &series_name)
Removes all data points from a named series.
Model chartBackground() const
Retrieves the Model representing the chart background (grid, axes).
Model getSeries(const StringView &series_name) const
Retrieves the Model representing a named data series.
Model createCursor(const StringView &series_name, const CursorAppearance &apperance)
Creates a new cursor overlay for a named series.
Model cursorContainer() const
Retrieves the container Model that holds all cursors.
Bounds< 3, fltp08 > chartBounds() const
Retrieves the current data bounds of the chart.
void adjustChartBounds(const Bounds< 3, fltp08 > &bounds)
Expands the chart bounds to encompass the given bounds.
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:57
The core String View class for the NDEVR API.
Definition StringView.h:58
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
A point in N-dimensional space, used primarily for spatial location information.
Definition Vertex.hpp:44
The primary namespace for the NDEVR SDK.
double fltp08
Defines an alias representing an 8 byte floating-point number.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Defines the visual appearance of the chart background, including grid lines, axis labels,...
void setupMajorSpacing(const Vertex< 3, uint04 > &dash_count, bool make_pretty_numbers)
Configures major grid line spacing based on a desired number of divisions.
TranslatedString title
The chart title displayed above the chart.
Bounds< 3, fltp08 > bounds
The data bounds of the chart area.
Font title_font
The font used for the chart title.
void setupScale(Ray< 3, fltp08 > desired_size)
Configures the axis scaling to fit a desired chart size.
Font minor_font
The font used for minor axis tick labels.
Ray< 3, fltp08 > major_spacing
The spacing between major grid lines per axis.
Vector< 3, TranslatedString > axis_names
The display names for each axis (X, Y, Z).
Font major_font
The font used for major axis tick labels.
Vertex< 3, uint04 > minor_spacing
The number of minor grid subdivisions between major lines per axis.
Ray< 3, fltp08 > axis_scale
The scale factor applied to each axis for display.
RGBColor minor_color
The color of minor grid lines (semi-transparent by default).
RGBColor major_color
The color of major grid lines.
Defines the visual appearance of a chart cursor overlay.
RGBColor line_color
The color of the cursor tracking line.
Font font
The font used for cursor label text.
RGBColor indicator_color
The color of the cursor indicator marker.
uint01 axis
The axis along which the cursor tracks (e.g., X or Y).
Defines the visual appearance of a data series within the chart.
fltp08 depth_bias
Z-ordering bias to control draw order of overlapping series.
RGBColor color
The color of the series. Invalid indicates default/unset.
fltp08 thickness
The line or point thickness of the series.