Chart
Chart . Chart , , . .
Chart Series TChartSeries − , . . , . , . , , . Chart . , , , .
( Windows), C++Builder 6, , CHART .
Chart Additional . .
AllowPanning | - , . : pmNone − , pmHorizontal, pmVertical pmBoth − , |
AllowZoom | , |
Title | |
Foot | . -. Text |
Frame | |
Legend | − |
MarginLeft, MarginRight, MarginTop, MarginBottom | , , |
BottomAxis, LeftAxis, RightAxis | , . |
LeftWall, BottomWall, BackWall | , - |
SeriesList | , |
View3D | - |
View3DOptions | |
Chart3DPercent | (, ) |
, − , . Chart Edit Chart .
|
|
.
1. Chart1. (Editing Chart1) Chart, . Series Add − . . Pie − . OK . , , Chart1 . .
2. Titles. , Title − , TChart . Foot %.
3. Panel. , . , − ( Panel Color) ( Gradient Visible StartColor − EndColor). . Visible .
4. 3D : , , , ..
5. Legend, ( ) .
6. Series . Format Circled Pie, Chart .
7. Marks Style , , : Value − , Percent − , Label − .. Percent, General .
8. Chart1 , Series Chart Clone, Change () − Bar. , . Series Chart. Chart1 . .
9. Chart2, . Editing Chart2.
10. Series Chart Add Line . OK, Series Chart Title SIN. , COS.
|
|
11. Axis . Axis Left. Title - Title: F, Angle: − 0, Font − 16. Axis Bottom, Title: X .
12. Titles Title SIN COS.
13. Panel , .
14. Walls .
15. 3D 3Dimensions. .
16. Series, − Format. Line Border Border Color Editor Width 3.
. , , . , − .
Series. Clear .
Add
long int Add(const double AValue, const String ALabel, TColor AColor);
. AValue , ALabel − , , AColor − . ALabel − , : .
AddXY
long int AddXY(double AXValue, double AYValue, const String ALabel, TColor);
. AXValue AYValue . ALabel AColor − , Add.
17. , , Button1 , Close();.
18. Button2 , :
void __fastcall TForm1::Button2Click(TObject *Sender)
{
int A1=5;
int A2=8;
int A3=5;
int A4=2;
const Pi=3.14159;
Series1->Clear();
Series2->Clear();
Series1->Add(A1,"",clYellow);
Series1->Add(A2,"",clBlue);
Series1->Add(A3,"",clRed);
Series1->Add(A4,"",clPurple);
Series3->Clear();
Series4->Clear();
for(int i=0; i<=100; i++)
{
Series3->AddXY(0.02*Pi*i,sin(0.02*Pi*i),"",clRed);
Series4->AddXY(0.02*Pi*i,cos(0.02*Pi*i),"",clBlue); }
Series2->Assign(Series1);
Series2->Active=false;
}
Pie Bar . Chart1. , Chart1 OnClickSeries :
void __fastcall TForm1::Chart1ClickSeries(TCustomChart *Sender,
TChartSeries *Series, int ValueIndex, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
Series1->Active=!Series1->Active;
Series2->Active=!Series2->Active;
}
19. #include <math.h>. . , . , , − .
Image
Image . Canvas (, ), , . , C++Builder.
|
|
X Y. , C++Builder, . X , Y − .
. − , . − . TColor. C++Builder TColor. (, clBlue − ), , Windows (, clBtnFace − ).
Pixels. Canvas->Pixels[int X][int Y], . , Canvas->Pixels[10][20] , 10- 20- . : , , . , Canvas->Pixels[10][20]=clBlack − .
, F(X) Image1, Ymax Ymin Xmin Xmax. :
float X,Y; //
int PX,PY; //
for(PX=0;PX<=Image1->Width;PX++)
{
// X - , PX
X=Xmin+PX*(Xmax-Xmin)/Image1->Width;
Y=F(X);
// PY - , Y
PY=Image1->Height-(Y-Ymin)* Image1->Height/(Ymax-Ymin);
//
Image1->Canvas->Pixels[PX][PY]=clRed;
}
PX Image1. PX X. Y. PY. (PX, PY) .
sin(X), Xmin =0, Xmax =4 (2 ), Ymin =-1 Ymax =1.
− Pen − . , . Color − , . − Width ( ). . 1.
Style :
psSolid | |
psDash | |
psDot | |
psDashDot | - |
psDashDotDot | , |
psClear | |
psInsideFrame | , Width>1 , Windows |
Width =1. .
psInsideFrame − , . Windows.
PenPos. . , .. PenPos, MoveTo(X,Y). (X,Y) − , . , LineTo(X,Y) (X,Y). , LineTo .
|
|
.
1. ( Windows), C++Builder 6, , IMAGE .
2. Image . , . , Size.
3. , Label1 , − Label2, .
4. Button1 . Close();.
5. Button2, , :
void __fastcall TForm1::Button2Click(TObject *Sender)
{
#define Pi 3.14159
float X,Y; //
int PX,PY; //
// -
//
Image2->Canvas->MoveTo(0,Image2->Height/2);
//
Image2->Canvas->Pen->Color=clRed;
//
Image2->Canvas->Pen->Width=3;
for(PX=0;PX<=Image1->Width;PX++)
{
// X - , PX
X=PX*4*Pi/Image1->Width;
Y=sin(X);
// PY - , Y
PY=Image1->Height-(Y+1)* Image1->Height/2;
//
Image1->Canvas->Pixels[PX][PY]=clRed;
//
Image2->Canvas->LineTo(PX,PY);
}
}
6. #include <math.h>. . , . − − . . , , .
Image − , . , Image, . , : Y=2*sin(X);. . , , . , - .