Page 1 of 1
Radar Chart issue with Let Axis Minimum
Posted: Tue Jun 23, 2009 11:39 am
by 10047633
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
:
//---------------------------------------------------------------------------//
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
Re: Radar Chart issue with Let Axis Minimum
Posted: Tue Jun 23, 2009 2:02 pm
by yeray
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:
Re: Radar Chart issue with Let Axis Minimum
Posted: Tue Jun 23, 2009 3:56 pm
by 10047633
I added the Chart1.Repaint but still no luck. Can you reproduce the issue?
Regards,
Ricardo
Re: Radar Chart issue with Let Axis Minimum
Posted: Thu Jun 25, 2009 7:41 am
by yeray
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?
Re: Radar Chart issue with Let Axis Minimum
Posted: Thu Jun 25, 2009 12:02 pm
by 10047633
Hey ... That solved the problem. I was using the Repaint in the end instead of between the Axis change.
Thanks!
Best regards,
Ricardo Abech
Re: Radar Chart issue with Let Axis Minimum
Posted: Thu Jun 25, 2009 1:03 pm
by 10047633
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
Re: Radar Chart issue with Let Axis Minimum
Posted: Thu Jun 25, 2009 3:32 pm
by yeray
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;
Re: Radar Chart issue with Let Axis Minimum
Posted: Thu Jun 25, 2009 3:54 pm
by 10047633
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
Re: Radar Chart issue with Let Axis Minimum
Posted: Fri Jun 26, 2009 9:19 am
by yeray
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.
Re: Radar Chart issue with Let Axis Minimum
Posted: Fri Jun 26, 2009 9:29 am
by yeray
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;
Re: Radar Chart issue with Let Axis Minimum
Posted: Fri Jun 26, 2009 12:08 pm
by 10047633
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
Re: Radar Chart issue with Let Axis Minimum
Posted: Fri Jun 26, 2009 1:27 pm
by yeray
Hi Ricardo,
Yes, that's the bug I've added to the list.