dev/cpp/tchart_xlabel_intersection/Unit1.cpp

38 lines
1.1 KiB
C++

//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TLineSeries *ser1 = new TLineSeries (NULL),
*ser2 = new TLineSeries (NULL),
*ser3 = new TLineSeries (NULL);
Chart1->AddSeries(ser1);
Chart1->AddSeries(ser2);
Chart1->AddSeries(ser3);
ser3->Pen->Style = psClear;
size_t n = 1024;
for (size_t i = 0; i < n; ++i) {
ser1->AddXY (5 * i, i / 5);//, "a");
ser2->AddXY (5 * i + 1, 1 + i / 5);//, "b");
ser3->AddXY (5 * i, 100, "a");
ser3->AddXY (5 * i + 1, 100, "b");
}
}
//---------------------------------------------------------------------------