Hello!
Help me to draw the circular diagramme of type of a compass.
The circle is broken into 360 degrees.
The distance between labels should be regulated.
In a circle there is a sector, it should vary. For example, from 10 to 90 degrees.
There are also 5 arrows different are long. Their positions depend on their values.
[img]11.png[/img]
Help me to draw the circular diagramme of type of a compass.
-
- Newbie
- Posts: 20
- Joined: Thu Mar 26, 2009 12:00 am
- Location: Russia, Samara
Help me to draw the circular diagramme of type of a compass.
- Attachments
-
- Picture example
- 11.png (61.46 KiB) Viewed 3644 times
Re: Help me to draw the circular diagramme of type of a compass.
Hi BoikovSoft,
I think tha tthe easier way to do it would be drawing manually both the arrows and the text. For example:
I think tha tthe easier way to do it would be drawing manually both the arrows and the text. For example:
Code: Select all
uses series, TeeTools, Math;
var Series1: TPieSeries;
LabelsIncrement: Integer;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
Series1:=TPieSeries.Create(self);
Chart1.AddSeries(Series1);
Series1.AddPie(45, '', clTeal);
Series1.AddPie(270, '', clNavy);
Series1.Marks.Visible:=false;
Series1.Circled:=true;
Series1.Shadow.Visible:=false;
LabelsIncrement:= 90;
Chart1.Title.Visible:=false;
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
procedure DrawAngleLabel(a: Integer);
var tmpX, tmpY: Integer;
begin
Series1.AngleToPos(DegToRad(a), Series1.XRadius, Series1.YRadius, tmpX, tmpY);
if a<180 then tmpY:=tmpY-12;
if (a>90) and (a<270) then tmpX:=tmpX-Chart1.Canvas.TextWidth(IntToStr(a));
Chart1.Canvas.TextOut(tmpX, tmpY, IntToStr(a));
end;
procedure DrawArrow(val: Double; angle: Integer; color: TColor);
var tmpFrom, tmpTo: TPoint;
tmpX, tmpY: Integer;
begin
Series1.AngleToPos(DegToRad(angle), Series1.XRadius*val, Series1.XRadius*val, tmpX, tmpY);
tmpFrom.X:=Series1.CircleXCenter;
tmpFrom.Y:=Series1.CircleYCenter;
tmpTo.X:=tmpX;
tmpTo.Y:=tmpY;
Chart1.Canvas.Pen.Width:=Round(3*val);
Chart1.Canvas.Pen.Color:=color;
Chart1.Canvas.Arrow(false, tmpFrom, tmpTo, Round(20*val), Round(20*val), 0);
end;
var angle: Integer;
begin
angle:=0;
while angle < 360 do
begin
DrawAngleLabel(angle);
angle:=angle+LabelsIncrement;
end;
DrawArrow(0.8, 210, clRed);
DrawArrow(0.7, 340, clGreen);
DrawArrow(1, 300, clYellow);
DrawArrow(0.4, 150, clYellow);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |