Chart is useful for displaying data.
The following procedure generates a series of random data and display in Chart as a Series.
Attachment 1: Executable file: chart01exe (Run in Windows after renaming it as chart01.exe))
Attachment 2: The whole VSC++ program (in VS2010)
Attachments 3/4: Another subtle versions: Chart02exe, Chart03exe
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{ int Y1[10], Y2[10];
int X[10];
int i;
String ^ name1 = "Selection"; // String in VSC++
chart1->Series->Clear();
chart1->Series->Add(name1);
// String ^ name2 = "Bubble"; // if another series is required
// chart1->Series->Add(name2);
for (i=0; i<10; i++)
{ Y1[i] = rand() & 1000;
X[i] = i+1;
chart1->Series[name1]->Points->AddXY(X[i], Y1[i]);
// Y2[i] = rand();
// chart1->Series[name2]->Points->AddXY(X[i], Y2[i]);
}
}
// Other possible settings==>
// chart1->Series[name1]->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::Spline;
// chart1->Series[name1]->BorderDashStyle = System::Windows::Forms::DataVisualization::Charting::SeriesBorderDashStyle::Dash;
// chart1->Series["Series1"]->Color = System::Drawing::Color::FromArgb(211, 36, 0);
// chart1->Series[name2]->ChartType = chart1->Series[name1]->ChartType;
More ChartType: