Ĺadny brzuch
Witam mam pytanie otóż chodzi mi o możliwość rysowania wykresu za pomocą komponentu tchar w taki sposób aby punkty wykresu pojawiały się kolejno na formatce wykresu z pewnym stałym opóźnieniem, w tym celu stworzyłem prostą petle opóźnienia w głównej petli rysowania wykresu jednak nie daje to rezultatu gdzyz zamiast punkty pojawiac się z określonym opóźnieniem cały wykres pojawia się z pewnym opóźnieniem Proszę o wszelkie sugestie i z góry dzięki za pomoc
for (f=0; f<=fmax; f++)
{
for (int i=0; i<20000; i++) {}
Chart1->Series[0]->AddXY(f,20*log10(k/sqrt(1+(f*T)*(f*T))));
}
Cały projekt wygląda mniej więcej tak, na formularzu jest tylko jeden button i komponent tchar
#include <stdio.h> #include <math.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) { int f,fmax; float P, Q, k, T, R, C, Cu; fmax=1000; R=100 ; C=500; Cu=C*0.000001; k=1; T=R*Cu; Chart1->Series[0]->Clear(); Chart1->Title->Text->Clear(); Chart1->Title->Text->Add("Charakterystyka amplitudowa"); Chart1->Title->Text->Add(" "); Chart1->Series[0]->Title="x1(t)"; for (f=0; f<=fmax; f++) { for (int i=0; i<20000; i++) {} Chart1->Series[0]->AddXY(f,20*log10(k/sqrt(1+(f*T)*(f*T)) )); } } //---------------------------------------------------------------------------
spox juz wiem opóźnienie trzeba zrobićna timerze :) np tak:
//--------------------------------------------------------------------------- void __fastcall TForm1::Timer1Timer(TObject *Sender) { if(a==1) { timer++; Chart1->Series[0]->AddXY(tab1[timer],tab2[timer]); } if (timer>=100){timer=0; a=0;} } //---------------------------------------------------------------------------
zanotowane.pl doc.pisz.pl pdf.pisz.pl zsf.htw.pl
for (f=0; f<=fmax; f++)
{
for (int i=0; i<20000; i++) {}
Chart1->Series[0]->AddXY(f,20*log10(k/sqrt(1+(f*T)*(f*T))));
}
Cały projekt wygląda mniej więcej tak, na formularzu jest tylko jeden button i komponent tchar
#include <stdio.h> #include <math.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) { int f,fmax; float P, Q, k, T, R, C, Cu; fmax=1000; R=100 ; C=500; Cu=C*0.000001; k=1; T=R*Cu; Chart1->Series[0]->Clear(); Chart1->Title->Text->Clear(); Chart1->Title->Text->Add("Charakterystyka amplitudowa"); Chart1->Title->Text->Add(" "); Chart1->Series[0]->Title="x1(t)"; for (f=0; f<=fmax; f++) { for (int i=0; i<20000; i++) {} Chart1->Series[0]->AddXY(f,20*log10(k/sqrt(1+(f*T)*(f*T)) )); } } //---------------------------------------------------------------------------
spox juz wiem opóźnienie trzeba zrobićna timerze :) np tak:
//--------------------------------------------------------------------------- void __fastcall TForm1::Timer1Timer(TObject *Sender) { if(a==1) { timer++; Chart1->Series[0]->AddXY(tab1[timer],tab2[timer]); } if (timer>=100){timer=0; a=0;} } //---------------------------------------------------------------------------