-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlot.h
More file actions
113 lines (103 loc) · 3.55 KB
/
Plot.h
File metadata and controls
113 lines (103 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#pragma once
#include <string>
#include <vector>
#include <float.h>
namespace GSA {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Plot
/// </summary>
public ref class Plot : public System::Windows::Forms::Form
{
public:
Plot(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
void setSeries(int code, std::vector<double> points) {
this->Text = code ? "Convergence plot" : "Best values plot";
this->series1->Points->Clear();
System::Windows::Forms::DataVisualization::Charting::Title^ title1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Title());
title1->Name = L"Title1";
title1->Text = code ? L"Convergence plot" : L"Best values plot";
this->chart1->Titles->Add(title1);
chartArea1->AxisY->Title = code ? L"difference between iterations" : L"best function value in iteration";
for (int i = 0; i < points.size(); i++)
{
double point = points[i];
System::Windows::Forms::DataVisualization::Charting::DataPoint^ dataPoint = (gcnew System::Windows::Forms::DataVisualization::Charting::DataPoint(i, round(point)));
this->series1->Points->Add(dataPoint);
}
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Plot()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::DataVisualization::Charting::Chart^ chart1;
System::Windows::Forms::DataVisualization::Charting::Series^ series1;
System::Windows::Forms::DataVisualization::Charting::ChartArea^ chartArea1;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container^ components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->chartArea1 = (gcnew System::Windows::Forms::DataVisualization::Charting::ChartArea());
this-> series1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Series());
this->chart1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Chart());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->chart1))->BeginInit();
this->SuspendLayout();
//
// chart1
//
this->chartArea1->Name = L"ChartArea1";
this->chartArea1->AxisX->Title = L"iterations";
this->chart1->ChartAreas->Add(chartArea1);
this->chart1->Location = System::Drawing::Point(12, 12);
this->chart1->Name = L"chart1";
series1->ChartArea = L"ChartArea1";
series1->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::Line;
series1->Legend = L"Legend1";
series1->Name = L"Series1";
series1->Color = Color::Red;
this->chart1->Series->Add(series1);
this->chart1->Size = System::Drawing::Size(697, 405);
this->chart1->TabIndex = 0;
this->chart1->Text = L"chart1";
//
// Plot
//
this->AutoScaleDimensions = System::Drawing::SizeF(9, 20);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(721, 429);
this->Controls->Add(this->chart1);
this->Name = L"Plot";
this->Text = L"Plot";
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->chart1))->EndInit();
this->ResumeLayout(false);
}
#pragma endregion
};
}