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 class NDEVR_CHARTS_API NDEVRChart : public QChartView
14 {
15 Q_OBJECT
16 public:
17 struct PlotData
18 {
22 QPen pen;
23
24 bool operator==(const PlotData& plot_data) const
25 {
26 return value == plot_data.value && line_data == plot_data.line_data && point_data == plot_data.point_data;
27 }
28 };
29 NDEVRChart(QWidget* parent = nullptr);
30 NDEVRChart(QChart* chart, QWidget* parent = nullptr);
31 bool event(QEvent* event) override;
32 void setSideAxes(const String& x_name, const String& y_name);
33 void setDarkThemed(bool dark);
34 void setTitle(const TranslatedString& title);
35 void addData(const PlotData& value);
36 void setData(const PlotData& value);
37 void setData(const Buffer<PlotData>& value);
38 void setLockedAxes(bool locked_axes) { m_locked_axes = locked_axes; }
39 void setPointSize(fltp04 point_size) { m_point_size = point_size; }
40 void setLineSize(fltp04 line_size) { m_line_size = line_size; }
41 void updateAxisScale(Bounds<3, fltp08> override_bounds = Constant<Bounds<3, fltp08>>::NaN);
42 void clearAll();
43 void redrawPlots();
44 const ConstPointer<Unit>& coordinateUnit() { return m_coordinate_unit; }
45 const ConstPointer<Unit>& hUnit() { return m_unit[X]; }
46 const ConstPointer<Unit>& vUnit() { return m_unit[Y]; }
47 void setUnit(const ConstPointer<Unit>& unit);
48 void setHUnit(const ConstPointer<Unit>& unit);
49 void setVUnit(const ConstPointer<Unit>& unit);
50 void setRelativeVertex(const Vertex<3, fltp08>& relative_vertex);
51 virtual void prepareAxes();
52 virtual Vertex<3, fltp08> positionToWorldSpace(const QPointF& point) const;
53 void mouseMoveEvent(QMouseEvent* event) override;
54 void mousePressEvent(QMouseEvent* event) override;
55 void mouseReleaseEvent(QMouseEvent* event) override;
56 Bounds<3, fltp08> resolvedBounds(Bounds<3, fltp08> override_bounds = Constant<Bounds<3, fltp08>>::NaN) const;
57 signals:
61 void onSeriesHoveredSignal(const PlotData& plot_data, Vertex<3, fltp08> vertex, bool hovered);
62 void onSeriesClickedSignal(const PlotData& plot_data, Vertex<3, fltp08> vertex);
63 protected slots:
64 void onSeriesHoveredSlot(uint04 index, const QPointF& point, bool state);
65 void onSeriesClickedSlot(uint04 index, const QPointF& point);
66 protected:
67 virtual void plotData(uint04 index);
68 void init();
69 void fontChanged();
70 fltp04 getDefaultMarkerSize() const;
71 fltp04 getDefaultLineSize() const;
72 fltp04 getLineSize() const;
73 fltp04 getMarkerSize() const;
74 protected:
77 QChart* m_base_chart;
78 bool m_is_dark = true;
79 bool m_locked_axes = true;
86 };
88 {
89 public:
90 NDEVRRadialChart(QWidget* parent = nullptr);
91 protected:
92 Vertex<3, fltp08> positionToWorldSpace(const QPointF& point) const override;
93 void plotData(uint04 index) override;
94 void prepareAxes() override;
95 protected:
96 QValueAxis* m_radial_axis;
97 QValueAxis* m_angular_axis;
98 QPolarChart* m_chart;
100 };
101}
#define NDEVR_CHARTS_API
Definition DLLInfo.h:74
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:59
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition GraphicsPipeline.h:42
Definition Matrix.hpp:176
Definition NDEVRChart.h:14
void setPointSize(fltp04 point_size)
Definition NDEVRChart.h:39
void onPressedSignal(Vertex< 3, fltp08 > vertex)
void setLockedAxes(bool locked_axes)
Definition NDEVRChart.h:38
const ConstPointer< Unit > & vUnit()
Definition NDEVRChart.h:46
QChart * m_base_chart
Definition NDEVRChart.h:77
void onHoveredSignal(Vertex< 3, fltp08 > vertex)
const ConstPointer< Unit > & coordinateUnit()
Definition NDEVRChart.h:44
void onSeriesClickedSignal(const PlotData &plot_data, Vertex< 3, fltp08 > vertex)
void onReleasedSignal(Vertex< 3, fltp08 > vertex)
void setLineSize(fltp04 line_size)
Definition NDEVRChart.h:40
Buffer< QValueAxis * > m_axes
Definition NDEVRChart.h:84
ConstPointer< Unit > m_coordinate_unit
Definition NDEVRChart.h:80
fltp04 m_line_size
Definition NDEVRChart.h:76
Buffer< PlotData > m_plot_data
Definition NDEVRChart.h:85
void onSeriesHoveredSignal(const PlotData &plot_data, Vertex< 3, fltp08 > vertex, bool hovered)
fltp04 m_point_size
Definition NDEVRChart.h:75
Bounds< 3, fltp08 > m_bounds
Definition NDEVRChart.h:83
Vertex< 3, fltp08 > m_relative_vertex
Definition NDEVRChart.h:82
const ConstPointer< Unit > & hUnit()
Definition NDEVRChart.h:45
Definition NDEVRChart.h:88
QValueAxis * m_angular_axis
Definition NDEVRChart.h:97
QValueAxis * m_radial_axis
Definition NDEVRChart.h:96
Matrix< fltp08 > m_transform
Definition NDEVRChart.h:99
QPolarChart * m_chart
Definition NDEVRChart.h:98
A polyline which stores vertex information for many points along a given path.
Definition CoordinateProjectionManager.h:44
The core String class for the software.
Definition String.h:47
Any text displayed to the user should be defined as a TranslatedString which allows the.
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.
Definition BaseValues.hpp:152
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:115
@ Y
Definition BaseValues.hpp:197
@ X
Definition BaseValues.hpp:195
Definition BaseValues.hpp:267
Definition NDEVRChart.h:18
QPen pen
Definition NDEVRChart.h:22
Buffer< Vertex< 3, fltp08 > > point_data
Definition NDEVRChart.h:21
bool operator==(const PlotData &plot_data) const
Definition NDEVRChart.h:24
TranslatedString value
Definition NDEVRChart.h:19
Polyline< 3, fltp08 > line_data
Definition NDEVRChart.h:20