I. Exemple d'utilisation de TPerformanceGraph▲
Sur une Form (Form1) poser un composant TPerformanceGraph (PerformanceGraph1) et un Timer (Timer1) avec sa propriété Interval à 100. Sur l'événement OnTimer de Timer1 mettre le code suivant :
Sélectionnez
#include <stdlib.h> //Pour la fonction rand()
//.............
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
static int x = 40;
x = x + rand()%5 - rand()%5;
PerformanceGraph1->DataPoint(clRed,x);
PerformanceGraph1->Update();
}On peut dessiner plusieurs tracés en appelant plusieurs fois la méthode DataPoint, avec des couleurs différentes en changeant son premier argument. C'est la méthode Update qui provoque le dessin du tracé et le fait avancer d'un pas.


