Represents a panel that displays a chart with sensor data over time. More...
#include <PanelSensor.h>


Public Member Functions | |
| PanelSensor (Panel *origin, std::string sensorId, std::string chartName) | |
| Constructor for PanelSensor. | |
| ~PanelSensor () | |
| Destructor for PanelSensor. | |
UI Updates | |
| void | UpdateGUI () |
| Updates the graphical user interface. Resizes UI elements based on the current window size. | |
| void | OnWindowResized (wxSizeEvent &event) |
| Handles window resize events. | |
| void | OnWindowMaximized (wxMaximizeEvent &event) |
| Handles window maximization events. | |
| void | OnFullScreen (wxFullScreenEvent &event) |
| Handles full-screen events. | |
Public Member Functions inherited from Panel | |
| Panel (Panel *origin) | |
| Constructs a new Panel and hides the previous one if provided. | |
| ~Panel () | |
| Destructor that deletes the current panel and restores the previous one. | |
| void | SetTitle (std::string title) |
| Sets the title of the main window. | |
Public Attributes | |
Sensor Information | |
| std::string | sensorId |
| Unique ID of the selected sensor. | |
| std::string | chartName |
| Name displayed on the chart. | |
UI Styling Configuration | |
| const int | styleObjectSpacingX = 10 |
| Horizontal spacing between UI elements. | |
| const int | styleObjectSpacingY = 10 |
| Vertical spacing between UI elements. | |
UI Elements | |
| wxStaticText * | textTop |
| Static text displaying the sensor selection message. | |
Chart Statistics | |
| int | chartValidCount |
| Total number of valid data points. | |
| float | chartSum |
| Sum of all data points. | |
| size_t | chartMinIndex = 0 |
| Index of the minimum value in the dataset. | |
| size_t | chartMaxIndex = 0 |
| Index of the maximum value in the dataset. | |
| float | chartStandardDeviationSum |
| Sum of squared deviations for standard deviation calculation. | |
| int | chartLocalValidCount |
| Number of valid points in the currently viewed range. | |
| float | chartLocalSum |
| Sum of data points in the viewed range. | |
| size_t | chartLocalMinIndex = 0 |
| Index of the minimum value in the viewed range. | |
| size_t | chartLocalMaxIndex = 0 |
| Index of the maximum value in the viewed range. | |
| float | chartLocalStandardDeviationSum |
| Sum of squared deviations for local standard deviation calculation. | |
Public Attributes inherited from Panel | |
| wxPanel * | panel |
| Pointer to the wxPanel instance managed by this class. | |
Data Fetching | |
| HttpFetcher * | httpFetcher = nullptr |
| Pointer to an HTTP fetcher instance. | |
| void | FetchData () |
| Initiates fetching of sensor data. | |
| void | OnDataFetched (wxThreadEvent &event) |
| Event handler for processing fetched sensor data. | |
Slider Control | |
| wxSlider * | slider |
| Slider for adjusting displayed data range. | |
| const int | sliderMinValue = 0 |
| Minimum value of the slider. | |
| const int | sliderMaxValue = 1000 |
| Maximum value of the slider. | |
| const int | startingValueCount = 24 |
| Default number of data points displayed. | |
| void | OnSliderChanged (wxCommandEvent &event) |
| Handles slider change events. | |
Summary Information | |
| wxRichTextCtrl * | summery1 |
| Rich text box displaying summary statistics. | |
| wxRichTextCtrl * | summery2 |
| Rich text box displaying transformed statistics. | |
| void | UpdateSummery1Text () |
| Updates the text in the summary box. | |
| void | UpdateSummeryTransofrm () |
| Applies transformations and updates the second summary box. | |
Chart and Data | |
| nlohmann::json | data |
| JSON object holding sensor data. | |
| wxLineChartCtrl * | chart = nullptr |
| Pointer to the line chart control. | |
| void | UpdateChart () |
| Updates the chart with the latest data. | |
| void | UpdateChartSize () |
| Adjusts the chart size based on the window size. | |
Navigation | |
| wxButton * | button_back |
| Button for navigating back to the previous panel. | |
| void | ButtonBack_OnButtonClick (wxCommandEvent &event) |
| Handles click events on the "Back" button. Closes the panel and returns to the previous screen. | |
Represents a panel that displays a chart with sensor data over time.
This panel is opened when a user selects a sensor from the PanelStation list. It fetches historical data, presents it in a chart, and provides statistical analysis.
| PanelSensor::PanelSensor | ( | Panel * | origin, |
| std::string | sensorId, | ||
| std::string | chartName ) |
Constructor for PanelSensor.
Initializes UI components and starts fetching sensor data.
| origin | Pointer to the parent panel. |
| sensorId | Unique identifier of the sensor. |
| chartName | Display name of the chart. |

| PanelSensor::~PanelSensor | ( | ) |
Destructor for PanelSensor.
Cleans up dynamically allocated resources and unbinds events.
| void PanelSensor::ButtonBack_OnButtonClick | ( | wxCommandEvent & | event | ) |
Handles click events on the "Back" button. Closes the panel and returns to the previous screen.
| event | The button click event. |
| void PanelSensor::FetchData | ( | ) |
Initiates fetching of sensor data.
If a fetch operation is already in progress, this function does nothing.
| void PanelSensor::OnDataFetched | ( | wxThreadEvent & | event | ) |
Event handler for processing fetched sensor data.
This method is triggered when an HTTP fetch operation is completed. It updates the local database and refreshes the chart.
| event | The event containing the fetched data. |
| void PanelSensor::OnFullScreen | ( | wxFullScreenEvent & | event | ) |
Handles full-screen events.
| event | The full-screen event. |
| void PanelSensor::OnSliderChanged | ( | wxCommandEvent & | event | ) |
Handles slider change events.
| void PanelSensor::OnWindowMaximized | ( | wxMaximizeEvent & | event | ) |
Handles window maximization events.
| event | The window maximize event. |
| void PanelSensor::OnWindowResized | ( | wxSizeEvent & | event | ) |
Handles window resize events.
| event | The window resize event. |
| void PanelSensor::UpdateChart | ( | ) |
Updates the chart with the latest data.
| void PanelSensor::UpdateChartSize | ( | ) |
Adjusts the chart size based on the window size.
| void PanelSensor::UpdateGUI | ( | ) |
Updates the graphical user interface. Resizes UI elements based on the current window size.
| void PanelSensor::UpdateSummery1Text | ( | ) |
Updates the text in the summary box.
| void PanelSensor::UpdateSummeryTransofrm | ( | ) |
Applies transformations and updates the second summary box.
| wxButton* PanelSensor::button_back |
Button for navigating back to the previous panel.
| wxLineChartCtrl* PanelSensor::chart = nullptr |
Pointer to the line chart control.
| size_t PanelSensor::chartLocalMaxIndex = 0 |
Index of the maximum value in the viewed range.
| size_t PanelSensor::chartLocalMinIndex = 0 |
Index of the minimum value in the viewed range.
| float PanelSensor::chartLocalStandardDeviationSum |
Sum of squared deviations for local standard deviation calculation.
| float PanelSensor::chartLocalSum |
Sum of data points in the viewed range.
| int PanelSensor::chartLocalValidCount |
Number of valid points in the currently viewed range.
| size_t PanelSensor::chartMaxIndex = 0 |
Index of the maximum value in the dataset.
| size_t PanelSensor::chartMinIndex = 0 |
Index of the minimum value in the dataset.
| std::string PanelSensor::chartName |
Name displayed on the chart.
| float PanelSensor::chartStandardDeviationSum |
Sum of squared deviations for standard deviation calculation.
| float PanelSensor::chartSum |
Sum of all data points.
| int PanelSensor::chartValidCount |
Total number of valid data points.
| nlohmann::json PanelSensor::data |
JSON object holding sensor data.
| HttpFetcher* PanelSensor::httpFetcher = nullptr |
Pointer to an HTTP fetcher instance.
| std::string PanelSensor::sensorId |
Unique ID of the selected sensor.
| wxSlider* PanelSensor::slider |
Slider for adjusting displayed data range.
| const int PanelSensor::sliderMaxValue = 1000 |
Maximum value of the slider.
| const int PanelSensor::sliderMinValue = 0 |
Minimum value of the slider.
| const int PanelSensor::startingValueCount = 24 |
Default number of data points displayed.
| const int PanelSensor::styleObjectSpacingX = 10 |
Horizontal spacing between UI elements.
| const int PanelSensor::styleObjectSpacingY = 10 |
Vertical spacing between UI elements.
| wxRichTextCtrl* PanelSensor::summery1 |
Rich text box displaying summary statistics.
| wxRichTextCtrl* PanelSensor::summery2 |
Rich text box displaying transformed statistics.
| wxStaticText* PanelSensor::textTop |
Static text displaying the sensor selection message.