Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ref class Form1 : public System::Windows::Forms::Form
- {
- cli::array<float, 1>^ m_dataArray;
- Form1(void):
- m_dataArray(gcnew cli::array<float, 1>(256))
- {
- InitializeComponent();
- ConfigureGraph(m_spectraGraph1);
- }
- // Windows forms generated code (cut down for brevity)
- void InitializeComponent(void)
- {
- chartArea1->Name = L"ChartArea1";
- this->m_spectraGraph1->ChartAreas->Add(chartArea1);
- this->m_spectraGraph1->Dock = System::Windows::Forms::DockStyle::Fill;
- legend1->Name = L"Legend1";
- this->m_spectraGraph1->Legends->Add(legend1);
- this->m_spectraGraph1->Location = System::Drawing::Point(3, 3);
- this->m_spectraGraph1->Name = L"m_spectraGraph1";
- series1->ChartArea = L"ChartArea1";
- series1->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::FastLine;
- series1->Legend = L"Legend1";
- series1->Name = L"Series1";
- this->m_spectraGraph1->Series->Add(series1);
- this->m_spectraGraph1->Size = System::Drawing::Size(331, 253);
- this->m_spectraGraph1->TabIndex = 0;
- this->m_spectraGraph1->Text = L"chart1";
- }
- void ConfigureGraph(System::Windows::Forms::DataVisualization::Charting::Chart^% chart1)
- {
- chart1->DataSource = m_dataArray;
- chart1->Legends->Clear();
- }
- void UpdateChart()
- {
- Random r(DateTime::Now.Millisecond);
- int count = m_dataArray->Length;
- for(int i = 0; i < count; ++i)
- {
- m_dataArray[i] = r.Next(90,110)/100.0f;
- }
- m_spectraGraph1->DataBind();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement