Radar Chart issue with Let Axis Minimum

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
RPABECH
Newbie
Newbie
Posts: 6
Joined: Thu Dec 06, 2007 12:00 am

Radar Chart issue with Let Axis Minimum

Post by RPABECH » Tue Jun 23, 2009 11:39 am

Hi,

For some reason my Radar Chart do not update the Left Axis minimum value. I wand to set the minimum value to (-1/3) of the Maximum Scale.
Ex: if MAx Scale = 900 the Minimum should be -300.

But when I run my project and click the button, it does not work at first. I can go to ythe chart editor and see that the Axis are -0.33 of the Max scale, but for some reason the chart do not update the Minimum Left Axis. IF I click the Button again, then it works. What I am doing wrong?

This is my code (using Delphi 7 and TeeChart 8):
//---------------------------------------------------------------------------//
procedure TForm1.Button1Click(Sender: TObject);
begin
populate_radar(Series1,Series2,'1');
Chart1.Axes.Left.AutomaticMinimum:=false;
Chart1.Axes.Left.Minimum:=Chart1.Axes.Left.Maximum * (-0.33);
end;


procedure populate_radar(S1,S2:TRadarSeries;RadarIndex: string);
var
i:integer;
begin
S1.Clear;
S2.Clear;

for i:= 0 to 30 do
S1.AddXY(i*12,1 + Random(900),'Port ' + inttostr(i));

S1.ClockWiseLabels:=true;

for i:= 0 to 30 do
S2.AddXY(i*12,1 + Random(800),'Port ' + inttostr(i));
S2.ClockWiseLabels:=true;

end;
//---------------------------------------------------------------------------//



Thanks

Ricardo abech

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

Re: Radar Chart issue with Let Axis Minimum

Post by Yeray » Tue Jun 23, 2009 2:02 pm

Hi Ricardo,

Try forcing the chart to be repainted after the points generation. This will update the left axis maximum value and the calculation to obtain the minimum should be fine:

Code: Select all

Chart1.Repaint;
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

RPABECH
Newbie
Newbie
Posts: 6
Joined: Thu Dec 06, 2007 12:00 am

Re: Radar Chart issue with Let Axis Minimum

Post by RPABECH » Tue Jun 23, 2009 3:56 pm

I added the Chart1.Repaint but still no luck. Can you reproduce the issue?

Regards,

Ricardo

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

Re: Radar Chart issue with Let Axis Minimum

Post by Yeray » Thu Jun 25, 2009 7:41 am

Hi Ricardo,

I reproduced the issue and Chart1.Repaint call solved it for me here. Here is the full code I use:

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeeComma, ExtCtrls, TeeProcs, TeEngine, Chart, Series, TeePolar,
  StdCtrls;

type
  TForm1 = class(TForm)
    TeeCommander1: TTeeCommander;
    Button1: TButton;
    Chart1: TChart;
    Series1: TRadarSeries;
    Series2: TRadarSeries;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure populate_radar(S1,S2:TRadarSeries;RadarIndex: string);
var i:integer;
begin
  S1.Clear;
  S2.Clear;

  for i:= 0 to 30 do
    S1.AddXY(i*12,1 + Random(900),'Port ' + inttostr(i));

  S1.ClockWiseLabels:=true;

  for i:= 0 to 30 do
    S2.AddXY(i*12,1 + Random(800),'Port ' + inttostr(i));

  S2.ClockWiseLabels:=true;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  populate_radar(Series1,Series2,'1');
  Chart1.Repaint;
  Chart1.Axes.Left.AutomaticMinimum:=false;
  Chart1.Axes.Left.Minimum:=Chart1.Axes.Left.Maximum * (-0.33);
end;

end.
If you still can't see the issue solved, please, could you please try to send us the simple project where you can reproduce it?
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

RPABECH
Newbie
Newbie
Posts: 6
Joined: Thu Dec 06, 2007 12:00 am

Re: Radar Chart issue with Let Axis Minimum

Post by RPABECH » Thu Jun 25, 2009 12:02 pm

Hey ... That solved the problem. I was using the Repaint in the end instead of between the Axis change.

Thanks!

Best regards,

Ricardo Abech

RPABECH
Newbie
Newbie
Posts: 6
Joined: Thu Dec 06, 2007 12:00 am

Re: Radar Chart issue with Let Axis Minimum

Post by RPABECH » Thu Jun 25, 2009 1:03 pm

A new problem. When I use the Anti-Alias in my Radar PLot, for some reason the PEN of my RadarSeries becomes Black.

I would like to keep the currnt color of the Pen.

Regards,

Ricarod Abech

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

Re: Radar Chart issue with Let Axis Minimum

Post by Yeray » Thu Jun 25, 2009 3:32 pm

Hi Ricardo,

I've added the following code to the previous and everything seems to work as expected:

Code: Select all

uses TeeAntiAlias;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.Tools.Add(TAntiAliasTool.Create(self));
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

RPABECH
Newbie
Newbie
Posts: 6
Joined: Thu Dec 06, 2007 12:00 am

Re: Radar Chart issue with Let Axis Minimum

Post by RPABECH » Thu Jun 25, 2009 3:54 pm

HI,

Yes, the Anti-Alias works. But my Pen Color gets changed to Black for all series. I really need them to keep their colors.

See attached file.

Thanks.

Best regards,

Ricardo Abech
Attachments
Untitled.jpg
Untitled.jpg (26.19 KiB) Viewed 6369 times

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

Re: Radar Chart issue with Let Axis Minimum

Post by Yeray » Fri Jun 26, 2009 9:19 am

Hi Ricardo,

I've tried to reproduce your problem again and couldn't. Here is the code I use to create a chart similar to yours:

Code: Select all

uses TeeAntiAlias, Series, TeePolar;

procedure populate_radar(S1,S2:TRadarSeries;RadarIndex: string);
var i:integer;
begin
  S1.Clear;
  S2.Clear;

  for i:= 0 to 30 do
    S1.AddXY(i*12,1 + Random(900),'Port ' + inttostr(i));

  S1.ClockWiseLabels:=true;

  for i:= 0 to 30 do
    S2.AddXY(i*12,1 + Random(800),'Port ' + inttostr(i));

  S2.ClockWiseLabels:=true;
end;

procedure TForm1.FormCreate(Sender: TObject);
var series1, series2: TRadarSeries;
begin
  Chart1.View3D := false;
  Chart1.Color := clWhite;

  Chart1.Tools.Add(TAntiAliasTool.Create(self));

  series1 := TRadarSeries.Create(self);
  series2 := TRadarSeries.Create(self);
  Chart1.AddSeries(series1);
  Chart1.AddSeries(series2);

  series1.Color := clBlue;
  series1.Pointer.VertSize := 2;
  series1.Pointer.HorizSize := 2;
  series1.Brush.Style := bsSolid;
  series1.Transparency := 50;

  series2.Color := clYellow;
  series2.Pointer.VertSize := 2;
  series2.Pointer.HorizSize := 2;
  series2.Brush.Style := bsSolid;
  series2.Transparency := 50;

  populate_radar(series1, series2,'1');
  Chart1.Repaint;
  Chart1.Axes.Left.AutomaticMinimum:=false;
  Chart1.Axes.Left.Minimum:=Chart1.Axes.Left.Maximum * (-0.33);
end;
Please, modify the code above or simplify your code til get a code as simple as possible we can run as-is here to reproduce the problem here.
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

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

Re: Radar Chart issue with Let Axis Minimum

Post by Yeray » Fri Jun 26, 2009 9:29 am

Hi Ricardo,

Now I could reproduce it. The problem seems to be with the combination AntiAlias Tool + Rose Series Pen Width greater than 1. I've added it to the wish list to be fixed in future releases (TV52014265).

Code: Select all

uses TeeAntiAlias, Series, TeePolar;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D := false;

  Chart1.Tools.Add(TAntiAliasTool.Create(self));

  Chart1.AddSeries(TRadarSeries.Create(self));
  Chart1[0].FillSampleValues(10);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Chart1[0].Pen.Width := 2;
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

RPABECH
Newbie
Newbie
Posts: 6
Joined: Thu Dec 06, 2007 12:00 am

Re: Radar Chart issue with Let Axis Minimum

Post by RPABECH » Fri Jun 26, 2009 12:08 pm

Yes. That works fine for PEN Width = 1. But if I increase that to 2 or more (I use 3), then The pen turns Black.

Do you see this same behaviour?

Regards,

Ricardo Abech

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

Re: Radar Chart issue with Let Axis Minimum

Post by Yeray » Fri Jun 26, 2009 1:27 pm

Hi Ricardo,

Yes, that's the bug I've added to the list.
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