Rotated Ellipse Series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
MicroSolutions
Newbie
Newbie
Posts: 1
Joined: Wed Jun 20, 2018 12:00 am

Rotated Ellipse Series

Post by MicroSolutions » Fri Nov 09, 2018 10:09 am

Dear Steema,

I would like to have a Rotated Ellipse behind a point series.
Is there any tool/series which is able to have rotated ellipses?
The shape series is pretty close, but it has no rotation. (as far as I see).

I have found a canvas function: self.Chart1.Canvas.RotatedEllips().
If no such an option I can write a tool.

Best Regards:
Ferenc

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Rotated Ellipse Series

Post by Yeray » Tue Nov 13, 2018 10:45 am

Hello Ferenc,

Indeed, there's the RotatedEllipse method to manually draw rotated ellipses. Here it is an example of usage:
Tee9new_2018-11-13_11-34-34.png
Tee9new_2018-11-13_11-34-34.png (216.07 KiB) Viewed 2955 times

You could use it (ie at OnBeforeDrawSeries event) to draw them behind your point series. Ie:
Project1_2018-11-13_11-44-59.png
Project1_2018-11-13_11-44-59.png (13.72 KiB) Viewed 2955 times

Code: Select all

uses Series, TeCanvas;

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
var P : TPointArray;
    tmpX, tmpY, i: Integer;
begin
  with Chart1.Canvas do
  begin
    for i:=0 to Chart1[0].Count-1 do
    begin
      tmpX:=Chart1[0].CalcXPos(i);
      tmpY:=Chart1[0].CalcYPos(i);
      Brush.Color:=Chart1[0].ValueColor[i];

      RotatedEllipse(tmpX-Round(10+random*10),tmpY-Round(10+random*10),tmpX+Round(10+random*10),tmpY+Round(10+random*10),0, random*360);
    end;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.Legend.Hide;
  Chart1.View3D:=False;

  with Chart1.AddSeries(TPointSeries) as TPointSeries do
  begin
    ColorEachPoint:=True;
    FillSampleValues(10);
  end;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply