Здравствуйте, с горем пополам вродь сделал график!...
Но столкнулся с проблемой, как увеличивать график и отдалять? и как поставить допустим над свечой №20 красный флажок или типо того.
Спасибо большое.
C++ |
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
114
115
| #pragma once
namespace Chart {
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>
/// Сводка для Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: добавьте код конструктора
//
}
protected:
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::DataVisualization::Charting::Chart^ chart1;
protected:
private:
/// <summary>
/// Требуется переменная конструктора.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Обязательный метод для поддержки конструктора - не изменяйте
/// содержимое данного метода при помощи редактора кода.
/// </summary>
void InitializeComponent(void)
{
System::Windows::Forms::DataVisualization::Charting::ChartArea^ chartArea1 = (gcnew System::Windows::Forms::DataVisualization::Charting::ChartArea());
System::Windows::Forms::DataVisualization::Charting::Legend^ legend1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Legend());
System::Windows::Forms::DataVisualization::Charting::Series^ 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
//
chartArea1->AxisX->ScrollBar->ButtonColor = System::Drawing::Color::Yellow;
chartArea1->Name = L"ChartArea1";
this->chart1->ChartAreas->Add(chartArea1);
legend1->Name = L"Legend1";
this->chart1->Legends->Add(legend1);
this->chart1->Location = System::Drawing::Point(11, 11);
this->chart1->Margin = System::Windows::Forms::Padding(2);
this->chart1->Name = L"chart1";
series1->ChartArea = L"ChartArea1";
series1->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::Candlestick;
series1->Legend = L"Legend1";
series1->Name = L"Series1";
series1->YValuesPerPoint = 4;
this->chart1->Series->Add(series1);
this->chart1->Size = System::Drawing::Size(1366, 700);
this->chart1->TabIndex = 0;
this->chart1->Text = L"chart1";
this->chart1->Click += gcnew System::EventHandler(this, &Form1::chart1_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(1366, 700);
this->Controls->Add(this->chart1);
this->Margin = System::Windows::Forms::Padding(2);
this->Name = L"Form1";
this->Text = L"Form1";
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->chart1))->EndInit();
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void chart1_Click(System::Object^ sender, System::EventArgs^ e) {
this->chart1->Series["Series1"]->ChartType = DataVisualization::Charting::SeriesChartType::Candlestick;
this->AutoScroll = true;
this->AutoScrollMargin = System::Drawing::Size(10, 10);
this->chart1->Location = System::Drawing::Point(0, 0);
this->chart1->Series["Series1"]->YValuesPerPoint = 4;
for (int i = 0; i < 2000; i++)
{
this->chart1->Series["Series1"]->Points->AddXY(i, i);
this->chart1->Series["Series1"]->Points[i]->YValues[0] = i + 25; // high
this->chart1->Series["Series1"]->Points[i]->YValues[1] = i + 1; // low
this->chart1->Series["Series1"]->Points[i]->YValues[2] = i + 15; //close
this->chart1->Series["Series1"]->Points[i]->YValues[3] = i + 20; // open
}
}
};
} |
|