Radar

TeeChart for ActiveX, COM and ASP
Post Reply
AlbertoRG
Newbie
Newbie
Posts: 16
Joined: Fri Dec 05, 2014 12:00 am

Radar

Post by AlbertoRG » Thu Apr 23, 2015 9:14 am

Hi Team.

Im looking forward to built a radar chart and im wondering if there is any way to reach something like this. See pic attached.

Thanks in advance.

Best regards.
Attachments
combine_images1.jpg
Radar
combine_images1.jpg (158.74 KiB) Viewed 17440 times
Thanks, best regards.

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

Re: Radar

Post by Yeray » Thu Apr 23, 2015 9:26 am

Hello,

This looks very similar to the discussed here:
http://www.teechart.net/support/viewtop ... =3&t=15202
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

AlbertoRG
Newbie
Newbie
Posts: 16
Joined: Fri Dec 05, 2014 12:00 am

Re: Radar

Post by AlbertoRG » Thu Apr 23, 2015 9:31 am

Hi Thanks for the quick reply..

Will look into it.

Happy Sant Jordi btw..

Regards.
Thanks, best regards.

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

Re: Radar

Post by Yeray » Fri Apr 24, 2015 9:34 am

Hi Alberto,

Also note the TPolarGridSeries could fit your requirements:
polargrid.png
polargrid.png (159.14 KiB) Viewed 17317 times
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

AlbertoRG
Newbie
Newbie
Posts: 16
Joined: Fri Dec 05, 2014 12:00 am

Re: Radar

Post by AlbertoRG » Fri Apr 24, 2015 9:58 am

Hi Yeray.

Thanks, will have a look ¡

Best regards.
Thanks, best regards.

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

Re: Radar

Post by Yeray » Fri Apr 24, 2015 11:24 am

Hello again Alberto,

I've been playing with the TPolarSeries and that's the best I could achieve with it:
polargrid.png
polargrid.png (67.91 KiB) Viewed 17300 times

Code: Select all

const
    SectorNames : array[0..9] of string =
    (
      'POSSESSION', 'OFFENSIVENESS', 'HIGH PRESS', 'CROSSING',
      'FAST TEMPO', 'SUSTAINED THREAT', 'BUILD UP', 'MAINTENANCE',
      'COUNTER ATTACK', 'DIRECT PLAY'
    ) ;

    TeePiStep:Double      = Pi/180.0;

var Series1: TPolarGridSeries;

procedure TForm1.FormCreate(Sender: TObject);
var Sector, Track, tmpIndex: Integer;
begin
  //Chart1.Title.Visible:=false;
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;
  Chart1.Axes.Left.Visible:=false;
  Chart1.Axes.Left.Grid.Color:=clWhite;
  Chart1.Axes.Left.Grid.Style:=psDot;
  Chart1.Axes.Top.Visible:=false;
  Chart1.Axes.Bottom.Visible:=false;
  Chart1.Axes.Bottom.Grid.Visible:=false;
  Chart1.Axes.Right.Ticks.Visible:=false;
  Chart1.Axes.Right.MinorTicks.Visible:=false;
  Chart1.Axes.Right.LabelsFont.Color:=clWhite;
  Chart1.Axes.Right.LabelsFont.Size:=6;
  Chart1.Axes.Right.Axis.Visible:=false;
  Chart1.Axes.Left.Increment:=50;
  Chart1.AxisBehind:=false;
  Chart1.OnBeforeDrawSeries:=Chart1BeforeDrawSeries;

  Series1:=Chart1.AddSeries(TPolarGridSeries) as TPolarGridSeries;
  with Series1 do
  begin
    Palette.UseColorRange:=false;
    Color:=RGB(55, 47, 45);
    Pen.Color:=Color;
    CirclePen.Visible:=false;
    RotationAngle:=110;
    OnGetCircleLabel:=polarGetCircleLabels;

    NumSectors:=10;
    NumTracks:=255;
    for Sector:=0 to NumSectors-1 do
    begin
      for Track:=0 to NumTracks-1 do
      begin
        tmpIndex:=AddCell(Sector,Track,0);

        if (
           ((Sector=0) and (Track>110)) or
           ((Sector=1) and (Track>120)) or
           ((Sector=2) and (Track>100)) or
           ((Sector=3) and (Track>90)) or
           ((Sector=4) and (Track>180)) or
           ((Sector=5) and (Track>140)) or
           ((Sector=6) and (Track>160)) or
           ((Sector=7) and (Track>120)) or
           ((Sector=8) and (Track>140)) or
           ((Sector=9) and (Track>70))
           ) then
          SetNull(tmpIndex);
      end;
    end;
  end;

  Chart1.Draw;
end;

procedure TForm1.polarGetCircleLabels(Sender:TCustomPolarSeries; const Angle:Double; Index:Integer;
                                     var Text:String);
begin
  Text:=SectorNames[Index];

  if (Index>3) and (Index<5) then
    Chart1.Canvas.Pen.Style:=psSolid
  else
    Chart1.Canvas.Pen.Style:=psDash;
end;

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
var p : TPolarGridSeries;
begin
  p:=TPolarGridSeries(Chart1[0]);

  Chart1.Canvas.Brush.Style:=bsSolid;
  Chart1.Canvas.Brush.Color:=rgb(67, 152, 67);

  Chart1.Canvas.Ellipse(p.CircleRect);
end;

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
  if (Sender=Chart1.Axes.Right) then
  begin
    if LabelText='0' then
      LabelText:='-100%'
    else if LabelText='50' then
      LabelText:='-50%'
    else if LabelText='100' then
      LabelText:='0%'
    else if LabelText='150' then
      LabelText:='50%'
    else if LabelText='200' then
      LabelText:='100%'
    else if LabelText='250' then
      LabelText:='150%';
  end;

end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var tmpValue: Double;
    tmpX, tmpY: Integer;
begin
  Chart1.Canvas.Pen.Color:=clWhite;
  Chart1.Canvas.Pen.Width:=2;

  Series1.DrawRing(100, 0);

  tmpValue:=18;
  Chart1.Canvas.Pen.Width:=1;

  while tmpValue<(360-MinAxisIncrement) do
  begin
    Series1.AngleToPos(TeePiStep*tmpValue,Series1.XRadius,Series1.YRadius,tmpX,tmpY);
    Chart1.Canvas.LineWithZ(Series1.CircleXCenter,Series1.CircleYCenter,tmpX,tmpY,Series1.EndZ);

    tmpValue:=tmpValue+36;
  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

AlbertoRG
Newbie
Newbie
Posts: 16
Joined: Fri Dec 05, 2014 12:00 am

Re: Radar

Post by AlbertoRG » Fri Apr 24, 2015 11:37 am

Hi Yeray,

That looks very very close to what i need..thanks for the work.

I need to translate the sample to VB6 and see if i can get the same-

Thanks again.

Alberto.
Thanks, best regards.

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

Re: Radar

Post by Yeray » Fri Apr 24, 2015 2:42 pm

Hi Alberto,
AlbertoRG wrote:That looks very very close to what i need..thanks for the work.
We've just implemented a new DrawStyle so with the next version it will be possible to do this:

Code: Select all

Series1.DrawStyle := dsCircled;
This style still has to be polished (ie the circle labels aren't correctly positioned on the center of the slices) but it looks promising:
polargrid_curved.png
polargrid_curved.png (63.38 KiB) Viewed 17278 times
AlbertoRG wrote:I need to translate the sample to VB6 and see if i can get the same-
I'm sorry. Since TeeChart ActiveX is a wrapper from TeeChart VCL we have to develop the new features in Delphi and TeeChart ActiveX inherits them automatically or with a few adaptations.
If you find problems to translate it, don't hesitate to let us know.
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