API Documentation
Loading...
Searching...
No Matches
NDEVRChart.h
Go to the documentation of this file.
1#pragma once
2#include <NDEVR/String.h>
3#include <NDEVR/Unit.h>
4#include <NDEVR/Pointer.h>
5#include <NDEVR/PolyLine.h>
6#include "DLLInfo.h"
7#include <QChartView>
8class QValueAxis;
9class QChart;
10class QPolarChart;
11namespace NDEVR
12{
13 /**--------------------------------------------------------------------------------------------------
14 \brief Default base chart for 2D line or scatter plots within the NDEVR API
15 **/
16 class NDEVR_CHARTS_API NDEVRChart : public QChartView
17 {
18 Q_OBJECT
19 public:
20 struct PlotData
21 {
25 QPen pen;
26
27 bool operator==(const PlotData& plot_data) const
28 {
29 return value == plot_data.value && line_data == plot_data.line_data && point_data == plot_data.point_data;
30 }
31 };
32 NDEVRChart(QWidget* parent = nullptr);
33 NDEVRChart(QChart* chart, QWidget* parent = nullptr);
34 bool event(QEvent* event) override;
35 void setSideAxes(const String& x_name, const String& y_name);
36 void setDarkThemed(bool dark);
37 void setTitle(const TranslatedString& title);
38 void addData(const PlotData& value);
39 void setData(const PlotData& value);
40 void setData(const Buffer<PlotData>& value);
41 void setLockedAxes(bool locked_axes) { m_locked_axes = locked_axes; }
42 void setPointSize(fltp04 point_size) { m_point_size = point_size; }
43 void setLineSize(fltp04 line_size) { m_line_size = line_size; }
45 void clearAll();
47 const ConstPointer<Unit>& coordinateUnit() { return m_coordinate_unit; }
48 const ConstPointer<Unit>& hUnit() { return m_unit[X]; }
49 const ConstPointer<Unit>& vUnit() { return m_unit[Y]; }
50 void setUnit(const ConstPointer<Unit>& unit);
51 void setHUnit(const ConstPointer<Unit>& unit);
52 void setVUnit(const ConstPointer<Unit>& unit);
53 void setRelativeVertex(const Vertex<3, fltp08>& relative_vertex);
54 virtual void prepareAxes();
55 virtual Vertex<3, fltp08> positionToWorldSpace(const QPointF& point) const;
56 void mouseMoveEvent(QMouseEvent* event) override;
57 void mousePressEvent(QMouseEvent* event) override;
58 void mouseReleaseEvent(QMouseEvent* event) override;
60 signals:
64 void onSeriesHoveredSignal(const PlotData& plot_data, Vertex<3, fltp08> vertex, bool hovered);
65 void onSeriesClickedSignal(const PlotData& plot_data, Vertex<3, fltp08> vertex);
66 protected slots:
67 void onSeriesHoveredSlot(uint04 index, const QPointF& point, bool state);
68 void onSeriesClickedSlot(uint04 index, const QPointF& point);
69 protected:
70 virtual void plotData(uint04 index);
71 void init();
77 protected:
80 QChart* m_base_chart;
81 bool m_is_dark = true;
82 bool m_locked_axes = true;
89 };
90
91 /**--------------------------------------------------------------------------------------------------
92 \brief Default radial (round) base chart for 2D line or scatter plots within the NDEVR API
93 **/
95 {
96 public:
97 NDEVRRadialChart(QWidget* parent = nullptr);
98 protected:
99 Vertex<3, fltp08> positionToWorldSpace(const QPointF& point) const override;
100 void plotData(uint04 index) override;
101 void prepareAxes() override;
102 protected:
103 QValueAxis* m_radial_axis;
104 QValueAxis* m_angular_axis;
105 QPolarChart* m_chart;
107 };
108}
#define NDEVR_CHARTS_API
Definition DLLInfo.h:56
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:52
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition GraphicsPipeline.h:42
Definition Matrix.hpp:176
Default base chart for 2D line or scatter plots within the NDEVR API.
Definition NDEVRChart.h:17
void setPointSize(fltp04 point_size)
Definition NDEVRChart.h:42
NDEVRChart(QWidget *parent=nullptr)
void onPressedSignal(Vertex< 3, fltp08 > vertex)
virtual void plotData(uint04 index)
void updateAxisScale(Bounds< 3, fltp08 > override_bounds=Constant< Bounds< 3, fltp08 > >::Invalid)
void setLockedAxes(bool locked_axes)
Definition NDEVRChart.h:41
void mouseReleaseEvent(QMouseEvent *event) override
fltp04 getMarkerSize() const
const ConstPointer< Unit > & vUnit()
Definition NDEVRChart.h:49
QChart * m_base_chart
Definition NDEVRChart.h:80
void setData(const Buffer< PlotData > &value)
void setTitle(const TranslatedString &title)
void onHoveredSignal(Vertex< 3, fltp08 > vertex)
void mouseMoveEvent(QMouseEvent *event) override
bool event(QEvent *event) override
void setHUnit(const ConstPointer< Unit > &unit)
void setSideAxes(const String &x_name, const String &y_name)
const ConstPointer< Unit > & coordinateUnit()
Definition NDEVRChart.h:47
void mousePressEvent(QMouseEvent *event) override
void setUnit(const ConstPointer< Unit > &unit)
void setVUnit(const ConstPointer< Unit > &unit)
virtual void prepareAxes()
void onSeriesClickedSignal(const PlotData &plot_data, Vertex< 3, fltp08 > vertex)
void setRelativeVertex(const Vertex< 3, fltp08 > &relative_vertex)
void onReleasedSignal(Vertex< 3, fltp08 > vertex)
void setLineSize(fltp04 line_size)
Definition NDEVRChart.h:43
Buffer< QValueAxis * > m_axes
Definition NDEVRChart.h:87
void setData(const PlotData &value)
ConstPointer< Unit > m_coordinate_unit
Definition NDEVRChart.h:83
fltp04 m_line_size
Definition NDEVRChart.h:79
void onSeriesClickedSlot(uint04 index, const QPointF &point)
Buffer< PlotData > m_plot_data
Definition NDEVRChart.h:88
fltp04 getDefaultLineSize() const
fltp04 getLineSize() const
void onSeriesHoveredSignal(const PlotData &plot_data, Vertex< 3, fltp08 > vertex, bool hovered)
fltp04 m_point_size
Definition NDEVRChart.h:78
Bounds< 3, fltp08 > m_bounds
Definition NDEVRChart.h:86
virtual Vertex< 3, fltp08 > positionToWorldSpace(const QPointF &point) const
void setDarkThemed(bool dark)
fltp04 getDefaultMarkerSize() const
void addData(const PlotData &value)
Bounds< 3, fltp08 > resolvedBounds(Bounds< 3, fltp08 > override_bounds=Constant< Bounds< 3, fltp08 > >::Invalid) const
NDEVRChart(QChart *chart, QWidget *parent=nullptr)
Vertex< 3, fltp08 > m_relative_vertex
Definition NDEVRChart.h:85
void onSeriesHoveredSlot(uint04 index, const QPointF &point, bool state)
const ConstPointer< Unit > & hUnit()
Definition NDEVRChart.h:48
Default radial (round) base chart for 2D line or scatter plots within the NDEVR API.
Definition NDEVRChart.h:95
void prepareAxes() override
QValueAxis * m_angular_axis
Definition NDEVRChart.h:104
NDEVRRadialChart(QWidget *parent=nullptr)
QValueAxis * m_radial_axis
Definition NDEVRChart.h:103
Vertex< 3, fltp08 > positionToWorldSpace(const QPointF &point) const override
Matrix< fltp08 > m_transform
Definition NDEVRChart.h:106
QPolarChart * m_chart
Definition NDEVRChart.h:105
void plotData(uint04 index) override
A polyline which stores vertex information for many points along a given path.
Definition CoordinateProjectionManager.h:44
The core String class for the NDEVR API.
Definition String.h:69
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
A vertex or point. A specific type of Vector used primarily for spacial location information.
Definition Vertex.hpp:48
Definition ACIColor.h:37
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
Definition BaseValues.hpp:127
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
@ Y
Definition BaseValues.hpp:169
@ X
Definition BaseValues.hpp:167
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
Definition NDEVRChart.h:21
QPen pen
Definition NDEVRChart.h:25
Buffer< Vertex< 3, fltp08 > > point_data
Definition NDEVRChart.h:24
bool operator==(const PlotData &plot_data) const
Definition NDEVRChart.h:27
TranslatedString value
Definition NDEVRChart.h:22
Polyline< 3, fltp08 > line_data
Definition NDEVRChart.h:23