Page 1 of 1

Rotated Ellipse Series

Posted: Fri Nov 09, 2018 10:09 am
by 16483863
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

Re: Rotated Ellipse Series

Posted: Tue Nov 13, 2018 10:45 am
by yeray
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 6534 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 6534 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;