Power System Platform  2026w23a-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 OnClose(wxCloseEvent& event);
59 virtual void OnResize(wxSizeEvent& event);
60 virtual void OnMenuExpCSVClick(wxCommandEvent& event);
61 virtual void OnTreeItemActivated(wxTreeEvent& event);
62 virtual void OnTreeItemSelectionChanged(wxTreeEvent& event);
63 virtual void OnMenuDarkThemeClick(wxCommandEvent& event);
64 virtual void OnMenuExitClick(wxCommandEvent& event) { Close(); }
65 virtual void OnMenuFitClick(wxCommandEvent& event) { Fit(); }
66 virtual void OnMenuSaveImageClick(wxCommandEvent& event);
67 virtual void OnMenuSendClipClick(wxCommandEvent& event);
68 virtual void OnMenuShowCoordinatesClick(wxCommandEvent& event);
69 virtual void OnMenuShowGridClick(wxCommandEvent& event);
70 virtual void OnMenuShowLabelClick(wxCommandEvent& event);
71 virtual void OnPropertyGridChange(wxPropertyGridEvent& event);
72 virtual void OnRightClickDown(wxMouseEvent& event);
73 virtual void SetMPWindow();
74 virtual void SetTreectrl();
75 virtual void BuildColourList();
76 virtual wxColour GetNextColour();
77 virtual wxTreeItemId AllToYAxis(wxTreeItemId root);
78 virtual wxTreeItemId UpdateAllPlots(wxTreeItemId root);
79 virtual wxTreeItemId UpdateAllPlotsCharDir(wxTreeItemId root, XYChart* chartDir);
80 virtual wxString GetActiveCurvesCSV();
81 virtual wxTreeItemId GetActivePlotData(wxTreeItemId root, std::vector<PlotData*>& plotDataList);
82 virtual void DrawChartDir();
83 virtual void OnViewPortChanged(wxCommandEvent& event);
84 virtual void OnMouseMovePlotArea(wxCommandEvent& event);
85 virtual void DrawTrackLine(XYChart* chartDir);
86 virtual char DotOrComma() { return wxString::Format("%.1f", 0.1)[1]; };
87 virtual wxString GetUnitFromMagText(wxString magText);
88 virtual wxTreeItemId CalcXYLimits(wxTreeItemId root, XYChart* chartDir);
89
90 wxPGProperty* m_pgPropColor = nullptr;
91
92 wxTreeItemId m_treeTimeID;
93 wxTreeItemId m_selectedItemID;
94
95 std::vector<ElementPlotData> m_epdList;
96 std::vector<double> m_time;
97 std::vector<double> m_xAxisValues;
98
99 PlotLib m_plotLib = PlotLib::wxMATH_PLOT;
100
101 mpWindow* m_mpWindow = nullptr;
102 mpScaleX* m_xaxis = nullptr;
103 mpScaleY* m_yaxis = nullptr;
104 mpText* m_chartTitle = nullptr;
105 mpInfoCoords* m_coords = nullptr;
106 mpInfoLegend* m_leg = nullptr;
107
108 wxChartViewer* m_chartViewerDir = nullptr;
109 wxBoxSizer* m_sizerChart = nullptr;
110 wxSize m_chartViewerSize = wxSize(200, 200);
111 int m_legendHeight = 0;
112 int m_trackLinePos = 0;
113 double m_xMin = 0.0;
114 double m_xMax = 0.0;
115 double m_yMin = 0.0;
116 double m_yMax = 0.0;
117 bool m_firstPlot = true;
118 bool m_forceAxisLimits = false;
119 wxString m_sugestXLabel = _("Time (s)");
120 wxString m_sugestYLabel = "";
121 std::map<int, int> m_rawDataColour;
122
123 bool m_hideGrid = false;
124 bool m_showLeg = true;
125 bool m_showCoords = false;
126 bool m_darkTheme = false;
127
128 std::vector<wxColour> m_colourList;
129 std::vector<wxColour>::iterator m_itColourList;
130};
131#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...