Clarification on the box chart graphic

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Hardee
Newbie
Newbie
Posts: 22
Joined: Tue Nov 21, 2006 12:00 am

Clarification on the box chart graphic

Post by Hardee » Wed Aug 01, 2007 4:41 pm

Hello,

First I would like to thank Narcis Calvet for responding to my question in the teechart7.delphi news group about labels for the marks.

Second, I would like to know what the different parts of the box chart mean and how to change them. I am afraid I am not familiar with the terms inner and outer fence.

I would like the box ends to be at the quartile values of the distribution, which they appear to be. I would like the whisker ends to represent the 5th percentile and 95th percentile respectively. I'd also like to be able to change them to the 2.5th and 97.5th percentile.

Thank you for your help. I like the TeeChart but I need to learn to think like it does.

Hardee Mahoney
Washington, DC

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Aug 02, 2007 8:35 am

Hi Hardee,

In that case, reading the threads below about box plot may be helpful for you. Those are TeeChart for .NET topics but the same applies to TeeChart VCL.

http://www.teechart.net/support/viewtopic.php?t=2599
http://www.teechart.net/support/viewtopic.php?t=5645

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Hardee
Newbie
Newbie
Posts: 22
Joined: Tue Nov 21, 2006 12:00 am

Post by Hardee » Thu Aug 02, 2007 1:55 pm

Thanks for your response.

But I still don't seem to be able to draw the box plot where the lower whisker end is visually at the 5th percentile and the upper whisker end is at the 95th percentile. From your example you pointed me to, it seems the adjacentpoint properties control the whiskers but I can't get it to change the look of the plot.

Code: Select all

Your example:
// adjacent points are related with whisker lines
                  box1.AdjacentPoint1 = 37; // lower whisker at 37
                  box1.AdjacentPoint3 = 43; // upper whisker at 43 

here is my example

Code: Select all

Box := TBoxSeries.Create;
Box.Clear;

Box.UseCustomValues;

for i := 0 to 99 do
   Box.AddY(i);

Box.AdjacentPoint1 := 10;
Box.AdjacentPoint3 := 90;
Box.RecalcStats;
Box.Position := 0;
Box.ParentChart := Chart1;
Thanks

Hardee Mahoney
Washington, DC

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Aug 02, 2007 2:27 pm

Hi Hardee,

Code below displays a Box-Plot here. Can you please test if it works fine at your end?

Code: Select all

uses TeeBoxPlot;

procedure TForm1.FormCreate(Sender: TObject);
var Box: TBoxSeries;
    i: Integer;
begin
  Box := TBoxSeries.Create(self);
  Box.Clear;

  Box.UseCustomValues:=true;

  for i := 0 to 99 do
     Box.AddY(i);

  Box.AdjacentPoint1 := 10;
  Box.AdjacentPoint3 := 90;
  Box.RecalcStats;
  Box.Position := 0;
  Box.ParentChart := Chart1;
end;
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Hardee
Newbie
Newbie
Posts: 22
Joined: Tue Nov 21, 2006 12:00 am

Post by Hardee » Thu Aug 02, 2007 2:37 pm

It draws a box chart very nicely. But it doesn't change the way the whiskers look. I am hoping the top whisker will have its end at 90 and the bottom one at 10. It looks to me like the top one ends at the max and the bottom at the min.

I am using TChart Pro Version 7.07 in Delphi 7.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Aug 06, 2007 8:51 am

Hi Hardee,

Code below works fine here either using v7 or v8. Can you please test if it works fine at your end?

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var Box: TBoxSeries;
    i: Integer;
begin
  Box := TBoxSeries.Create(self);
  Box.ParentChart := Chart1;
  Box.Position := 0;
  Box.Clear;


  for i := 0 to 99 do
     Box.AddY(i);

  Box.UseCustomValues:=true;
  // If custom values are use, you have to define ALL box plot properties
  // bottom whisker
  Box.AdjacentPoint1 := 10;
  // top whisker
  Box.AdjacentPoint3 := 90;
  // box bounds
  Box.Quartile1 := 25;
  Box.Quartile3 := 75;
  Box.Median := 50;

  // Outliers
  // Mild outliers in (9,20) and (85,91)
  Box.InnerFence1 := 20;
  Box.InnerFence3 := 85;
  // Extreme outliers if <9 or >91
  Box.OuterFence1 := 9;
  Box.OuterFence3 := 91;
end;
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Hardee
Newbie
Newbie
Posts: 22
Joined: Tue Nov 21, 2006 12:00 am

Post by Hardee » Mon Aug 06, 2007 2:12 pm

Narcis,

Thank you very much for working with me on this.

When you run the code you gave me do you see the whisker ends - the black cross bar at the end of the whisker - appear at 10 and 90? When I run the code they appear at 0 and 99.

I can't understand what I am doing wrong.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Aug 06, 2007 2:39 pm

Hi Hardee,

It's most likely because, as commented out in the example code I posted, when using custom values, you have to define all box plot properties.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Hardee
Newbie
Newbie
Posts: 22
Joined: Tue Nov 21, 2006 12:00 am

Post by Hardee » Mon Aug 06, 2007 3:10 pm

Narcis,

Thanks so much for your help. I got it to work by taking out the recalcstats. I swore my code was just like yours, but...

Is this behavior for recalcstats like you expect?

Again, thanks for your help.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Aug 06, 2007 3:15 pm

Hi Hardee,
Thanks so much for your help. I got it to work by taking out the recalcstats. I swore my code was just like yours, but...
I'm glad to hear you got it working.
Is this behavior for recalcstats like you expect?


Yes, RecalcStats recalculates all parameters necessary to draw the box (Median, Quartiles, Inner and Outer points, etc.). This method can be called whenever the box underlying data is changed.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply