home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 March / Chip_1999-03_cd.bin / zkuste / delphi / D / MATEM.ARJ / RCHART.ZIP / exmpl-7 / cpp1 / timser.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-23  |  2.1 KB  |  66 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "timser.h"
  6. #include "math.h"
  7. //---------------------------------------------------------------------------
  8. #pragma link "RChart"
  9. #pragma link "NumLab"
  10. #pragma resource "*.dfm"
  11. TForm1 *Form1;
  12. //---------------------------------------------------------------------------
  13. __fastcall TForm1::TForm1(TComponent* Owner)
  14.     : TForm(Owner)
  15. {
  16. }
  17. //---------------------------------------------------------------------------
  18. void __fastcall TForm1::ButDoneClick(TObject *Sender)
  19. {
  20. Close();
  21. }
  22. //---------------------------------------------------------------------------
  23. void __fastcall TForm1::CBMYClick(TObject *Sender)
  24. {
  25. NumLab2->Visible = CBMY->Checked;
  26. }
  27. //---------------------------------------------------------------------------
  28. void __fastcall TForm1::CBMXClick(TObject *Sender)
  29. {
  30. NumLab1->Visible = CBMX->Checked;    
  31. }
  32. //---------------------------------------------------------------------------
  33. void __fastcall TForm1::FormActivate(TObject *Sender)
  34. {
  35. const int NumVal = 800;
  36. int i;
  37.  
  38. RChart1->RangeHiX = NumVal;
  39. RChart1->RangeLoX = 0;
  40. RChart1->RangeHiY = 150;
  41. RChart1->RangeLoY = -30;
  42. RChart1->DataColor = clBlue;
  43. RChart1->MoveTo (0,0);
  44. for (i=1; i<=NumVal; i++)
  45.   RChart1->DrawTo (i,0.1*i+0.03*i*sin(i*0.04)+0.04*(random(1000)));
  46. RChart1->DataColor = clRed;
  47. RChart1->MoveTo (0,40);
  48. for (i=1; i<=NumVal; i++)
  49.   RChart1->DrawTo (i,40+0.05*i*sin(i*0.05));
  50. }
  51. //---------------------------------------------------------------------------
  52. void __fastcall TForm1::RChart1MouseMoveInChart(TObject *Sender, bool InChart,
  53.     TShiftState Shift, double rMousePosX, double rMousePosY)
  54. {
  55. NumLab1->Empty = ! InChart;
  56. NumLab2->Empty = ! InChart;
  57. NumLab1->Value = rMousePosX;
  58. NumLab2->Value = rMousePosY;
  59. }
  60. //---------------------------------------------------------------------------
  61. void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift, int X,
  62.     int Y)
  63. {
  64. Screen->Cursor = crDefault;
  65. }
  66. //---------------------------------------------------------------------------