Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
ChartView.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef CHARTVIEW_H
19#define CHARTVIEW_H
20#include "ChartViewBase.h"
21
22#include <map>
23
24#include <wx/msgdlg.h>
25#include <wx/clipbrd.h>
26#include <wx/bitmap.h>
27#include <wx/dcscreen.h>
28#include <wx/filedlg.h>
29#include <wx/textfile.h>
30
31#include "../extLibs/wxMathPlot/mathplot.h"
32#include "../extLibs/wxChartDir/wxchartviewer.h"
33
34#include "../utils/PropertiesData.h"
35
36#define ID_CHARTVIEWER 11000
37
38class PlotData;
39class ElementPlotData;
40
48class ChartView : public ChartViewBase
49{
50public:
51 ChartView(wxWindow* parent, std::vector<ElementPlotData> epdList, std::vector<double> time, PlotLib plotLib = PlotLib::wxMATH_PLOT);
52 virtual ~ChartView();
53
54 void Fit();
55 void UpdatePlot(bool fit = true);
56
57protected:
58 virtual void OnResize(wxSizeEvent& event);
59 virtual void OnMenuExpCSVClick(wxCommandEvent& event);
60 virtual void OnTreeItemActivated(wxTreeEvent& event);
61 virtual void OnTreeItemSelectionChanged(wxTreeEvent& event);
62 virtual void OnMenuDarkThemeClick(wxCommandEvent& event);
63 virtual void OnMenuExitClick(wxCommandEvent& event) { Close(); }
64 virtual void OnMenuFitClick(wxCommandEvent& event) { Fit(); }
65 virtual void OnMenuSaveImageClick(wxCommandEvent& event);
66 virtual void OnMenuSendClipClick(wxCommandEvent& event);
67 virtual void OnMenuShowCoordinatesClick(wxCommandEvent& event);
68 virtual void OnMenuShowGridClick(wxCommandEvent& event);
69 virtual void OnMenuShowLabelClick(wxCommandEvent& event);
70 virtual void OnPropertyGridChange(wxPropertyGridEvent& event);
71 virtual void OnRightClickDown(wxMouseEvent& event);
72 virtual void SetMPWindow();
73 virtual void SetTreectrl();
74 virtual void BuildColourList();
75 virtual wxColour GetNextColour();
76 virtual wxTreeItemId AllToYAxis(wxTreeItemId root);
77 virtual wxTreeItemId UpdateAllPlots(wxTreeItemId root);
78 virtual wxTreeItemId UpdateAllPlotsCharDir(wxTreeItemId root, XYChart* chartDir);
79 virtual wxString GetActiveCurvesCSV();
80 virtual wxTreeItemId GetActivePlotData(wxTreeItemId root, std::vector<PlotData*>& plotDataList);
81 virtual void DrawChartDir();
82 virtual void OnViewPortChanged(wxCommandEvent& event);
83 virtual void OnMouseMovePlotArea(wxCommandEvent& event);
84 virtual void DrawTrackLine(XYChart* chartDir);
85 virtual char DotOrComma() { return wxString::Format("%.1f", 0.1)[1]; };
86 virtual wxString GetUnitFromMagText(wxString magText);
87 virtual wxTreeItemId CalcXYLimits(wxTreeItemId root, XYChart* chartDir);
88
89 wxPGProperty* m_pgPropColor = nullptr;
90
91 wxTreeItemId m_treeTimeID;
92 wxTreeItemId m_selectedItemID;
93
94 std::vector<ElementPlotData> m_epdList;
95 std::vector<double> m_time;
96 std::vector<double> m_xAxisValues;
97
98 PlotLib m_plotLib = PlotLib::wxMATH_PLOT;
99
100 mpWindow* m_mpWindow = nullptr;
101 mpScaleX* m_xaxis = nullptr;
102 mpScaleY* m_yaxis = nullptr;
103 mpText* m_chartTitle = nullptr;
104 mpInfoCoords* m_coords = nullptr;
105 mpInfoLegend* m_leg = nullptr;
106
107 wxChartViewer* m_chartViewerDir = nullptr;
108 wxBoxSizer* m_sizerChart = nullptr;
109 wxSize m_chartViewerSize = wxSize(200, 200);
110 int m_legendHeight = 0;
111 int m_trackLinePos = 0;
112 double m_xMin = 0.0;
113 double m_xMax = 0.0;
114 double m_yMin = 0.0;
115 double m_yMax = 0.0;
116 bool m_firstPlot = true;
117 bool m_forceAxisLimits = false;
118 wxString m_sugestXLabel = _("Time (s)");
119 wxString m_sugestYLabel = "";
120 std::map<int, int> m_rawDataColour;
121
122 bool m_hideGrid = false;
123 bool m_showLeg = true;
124 bool m_showCoords = false;
125 bool m_darkTheme = false;
126
127 std::vector<wxColour> m_colourList;
128 std::vector<wxColour>::iterator m_itColourList;
129};
130#endif // CHARTVIEW_H
This class is responsible to manage the charts generated in the transient electromechanical studies.
Definition ChartView.h:49
This class is responsible to manage the graphical data of electromechanical result to be plotted on c...