home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 March / Chip_1999-03_cd.bin / zkuste / delphi / D / MATEM.ARJ / RCHART.ZIP / exmpl-7 / cpp3 / timser.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-30  |  2.5 KB  |  77 lines

  1.  
  2. /*===========================================================
  3.  Please note, that the program RCHMOUSE uses the unit NumLab,
  4.  which are not supplied with the RCHART component. If you don't
  5.  have it, you can download a shareware copy from the following
  6.  WWW site: http://www.lohninger.com/
  7.  ===========================================================*/
  8.  
  9.  
  10.  
  11. //---------------------------------------------------------------------------
  12. #include <vcl\vcl.h>
  13. #pragma hdrstop
  14.  
  15. #include "timser.h"
  16. #include "math.h"
  17. #include "stdlib.h"
  18. //---------------------------------------------------------------------------
  19. #pragma link "RChart"
  20. #pragma link "NumLab"
  21. #pragma resource "*.dfm"
  22. TForm1 *Form1;
  23. //---------------------------------------------------------------------------
  24. __fastcall TForm1::TForm1(TComponent* Owner)
  25.     : TForm(Owner)
  26. {
  27. }
  28. //---------------------------------------------------------------------------
  29. void __fastcall TForm1::ButDoneClick(TObject *Sender)
  30. {
  31. Close();
  32. }
  33. //---------------------------------------------------------------------------
  34. void __fastcall TForm1::CBMYClick(TObject *Sender)
  35. {
  36. NumLab2->Visible = CBMY->Checked;
  37. }
  38. //---------------------------------------------------------------------------
  39. void __fastcall TForm1::CBMXClick(TObject *Sender)
  40. {
  41. NumLab1->Visible = CBMX->Checked;    
  42. }
  43. //---------------------------------------------------------------------------
  44. void __fastcall TForm1::FormActivate(TObject *Sender)
  45. {
  46. const int NumVal = 800;
  47. int i;
  48.  
  49. RChart1->RangeHiX = NumVal;
  50. RChart1->RangeLoX = 0;
  51. RChart1->RangeHiY = 150;
  52. RChart1->RangeLoY = -30;
  53. RChart1->DataColor = clBlue;
  54. RChart1->MoveTo (0,0);
  55. for (i=1; i<=NumVal; i++)
  56.   RChart1->DrawTo (i,0.1*i+0.03*i*sin(i*0.04)+0.04*(random(1000)));
  57. RChart1->DataColor = clRed;
  58. RChart1->MoveTo (0,40);
  59. for (i=1; i<=NumVal; i++)
  60.   RChart1->DrawTo (i,40+0.05*i*sin(i*0.05));
  61. }
  62. //---------------------------------------------------------------------------
  63. void __fastcall TForm1::RChart1MouseMoveInChart(TObject *Sender, bool InChart,
  64.     TShiftState Shift, double rMousePosX, double rMousePosY)
  65. {
  66. NumLab1->Empty = ! InChart;
  67. NumLab2->Empty = ! InChart;
  68. NumLab1->Value = rMousePosX;
  69. NumLab2->Value = rMousePosY;
  70. }
  71. //---------------------------------------------------------------------------
  72. void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift, int X,
  73.     int Y)
  74. {
  75. Screen->Cursor = crDefault;
  76. }
  77. //---------------------------------------------------------------------------