Hi to all,
I'm looking for a possibility to display a boxplot with a customized x-axis, for example for datetime entries.
Example:
DATE VALUES
01.01.07 10:00:00 0
01.01.07 10:00:00 2
01.01.07 10:00:00 3
...
01.01.07 10:00:00100
04.01.07 19:00:00 2
04.01.07 19:00:00 4
..
04.01.07 19:00:00 3
Now I would need two separate boxplots for the entries of VALUES, one for 01.01.07 10:00:00 and one for 04.01.07 19:00:00. I only found a position property which is an integer.
I would be grateful for any hint.
Regards,
Markus
Boxplot with datetime x-axis
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Markus,
One way to achieve what you request is using something like this:
One way to achieve what you request is using something like this:
Code: Select all
uses DateUtils;
procedure TForm1.FormCreate(Sender: TObject);
begin
With Series1 do
begin
AddArray([3,6,8,15,19,21]);
Position:=EncodeDateTime(07,01,01,10,0,0,0);
end;
With Series2 do
begin
AddArray([23,42,28,65,79,91]);
Position:=EncodeDateTime(04,01,07,19,0,0,0);
end;
Chart1.Axes.Bottom.AxisValuesFormat:='';
end;
procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
if Sender=Chart1.Axes.Bottom then
LabelText:=DateTimeToStr(StrToFloat(LabelText));
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Narcis,
great, that helped.
Now I want to add several boxplots dynamicallyand assign a OnMouseenter event:
procedure TForm1.Button3Click(Sender: TObject);
var aBoxSeries : TBoxSeries;
i : integer;
begin
DBChart1.RemoveAllSeries;
DBChart1.FreeAllSeries;
for i := 0 to 2 do
begin
aBoxSeries := TBoxSeries.Create(self);
aBoxSeries.AddArray([3,6,8,15,19,21]);
aBoxSeries.OnMouseEnter := Series1MouseEnter;
aBoxSeries.Cursor := crHandPoint;
aBoxSeries.ParentChart := DBChart1;
aBoxSeries.Title := 'Boxplot' + IntToStr(i);
aBoxSeries.Position := i;
DBChart1.AddSeries(aBoxseries);
DBChart1.Checkdatasource(aBoxSeries);
end;
end;
procedure TForm1.Series1MouseEnter(Sender: TObject);
begin
if sender is TBoxSeries then
begin
Form1.Caption := 'Entered: ' + (Sender as TBoxSeries).Title + ' position: ' +
FloatToStr((Sender as TBoxSeries).position);
end;
end;
procedure TForm1.DBChart1ClickSeries(Sender: TCustomChart; Series: TChartSeries;
ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
self.Caption := 'Clicked on ' + Series.Title;
end;
But if i point to any boxplot, i get "Entered Boxplot0 Position0" instead of the correct position and if i Click a boxplot I always get "Clicked on Boxplot2"
What did I do wrong?
Regards,
Markus
great, that helped.
Now I want to add several boxplots dynamicallyand assign a OnMouseenter event:
procedure TForm1.Button3Click(Sender: TObject);
var aBoxSeries : TBoxSeries;
i : integer;
begin
DBChart1.RemoveAllSeries;
DBChart1.FreeAllSeries;
for i := 0 to 2 do
begin
aBoxSeries := TBoxSeries.Create(self);
aBoxSeries.AddArray([3,6,8,15,19,21]);
aBoxSeries.OnMouseEnter := Series1MouseEnter;
aBoxSeries.Cursor := crHandPoint;
aBoxSeries.ParentChart := DBChart1;
aBoxSeries.Title := 'Boxplot' + IntToStr(i);
aBoxSeries.Position := i;
DBChart1.AddSeries(aBoxseries);
DBChart1.Checkdatasource(aBoxSeries);
end;
end;
procedure TForm1.Series1MouseEnter(Sender: TObject);
begin
if sender is TBoxSeries then
begin
Form1.Caption := 'Entered: ' + (Sender as TBoxSeries).Title + ' position: ' +
FloatToStr((Sender as TBoxSeries).position);
end;
end;
procedure TForm1.DBChart1ClickSeries(Sender: TCustomChart; Series: TChartSeries;
ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
self.Caption := 'Clicked on ' + Series.Title;
end;
But if i point to any boxplot, i get "Entered Boxplot0 Position0" instead of the correct position and if i Click a boxplot I always get "Clicked on Boxplot2"
What did I do wrong?
Regards,
Markus
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Markus,
There seems to be a problem with TBoxSeries' Clicked method as code below doesn't work fine either.
I've added this defect (TV52012319) to our bug list to be fixed for future releases.
There seems to be a problem with TBoxSeries' Clicked method as code below doesn't work fine either.
Code: Select all
procedure TForm1.DBChart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var i: Integer;
begin
for i:=0 to DBChart1.SeriesCount-1 do
if DBChart1[i].Clicked(X,Y) <> -1 then
begin
Form1.Caption := 'Entered: ' + DBChart1[i].Title + ' position: ' +
FloatToStr((DBChart1[i] as TBoxSeries).position);
break;
end;
end;
procedure TForm1.DBChart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var i: Integer;
begin
for i:=0 to DBChart1.SeriesCount-1 do
if DBChart1[i].Clicked(X,Y) <> -1 then
self.Caption := 'Clicked on ' + DBChart1[i].Title;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi.
Thanks for reporting this one. The TCustomBoxPlot series does not yet implement Clicked method. We'll try to improve this in future.
Thanks for reporting this one. The TCustomBoxPlot series does not yet implement Clicked method. We'll try to improve this in future.
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Markus,
Clicked method for BoxPlot series has been implemented in TeeChart Pro v8.01 which has posted last weekend at the client download area.
Clicked method for BoxPlot series has been implemented in TeeChart Pro v8.01 which has posted last weekend at the client download area.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |