Page 1 of 1

Difficulty with creating special chart.

Posted: Thu Apr 02, 2020 7:44 am
by 16488416
Hi I am quite a newbie with charting end definitely with TeeChart. I need to create a chart as per the included image but have no idea how to approach it. I have investigated XY plots as well as polar plots but am not able to create this.
RadialPlot.jpg
RadialPlot.jpg (61.94 KiB) Viewed 7808 times
Some guidance will be appreciated
Regards and stay safe.

Re: Difficulty with creating special chart.

Posted: Tue Apr 14, 2020 8:04 am
by yeray
Hello,

Here a simple example using ColorLineTools for the green lines and manually drawing the circles at OnBeforeDrawSeries event:

Code: Select all

uses Series, VCLTee.TeeTools;

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
const radius: array of Double=[3.9, 7.5, 11, 14.5];
var i, x, y, w, h: Integer;
begin
  for i:=0 to High(radius) do
  begin
    with Chart1.Canvas do
    begin
      Brush.Clear;
      Pen.Color:=clBlack;
      Pen.Width:=1;
      Pen.Style:=psDot;
      with Chart1.Axes do
        Ellipse(Bottom.CalcPosValue(radius[i]), Left.CalcPosValue(radius[i]),
                Bottom.CalcPosValue(-radius[i]), Left.CalcPosValue(-radius[i]));
    end;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=False;
  Chart1.Legend.Hide;
  Chart1.Axes.Left.SetMinMax(-16,16);
  Chart1.Axes.Bottom.SetMinMax(-16,16);

  with TColorLineTool(Chart1.Tools.Add(TColorLineTool)) do
  begin
    Axis:=Chart1.Axes.Left;
    Pen.Color:=clGreen;
    Pen.Width:=2;
    Value:=0;
  end;

  with TColorLineTool(Chart1.Tools.Add(TColorLineTool)) do
  begin
    Axis:=Chart1.Axes.Bottom;
    Pen.Color:=clGreen;
    Pen.Width:=2;
    Value:=0;
  end;

  with TPointSeries(Chart1.AddSeries(TPointSeries)) do
  begin
    Pointer.Size:=2;
    Pointer.Style:=psCircle;
    AddXY(-7.5,-7);
    AddXY(14.5, 14.5);
  end;
end;
Project1_2020-04-14_10-03-02.png
Project1_2020-04-14_10-03-02.png (30.57 KiB) Viewed 7745 times