[SOLVED] Forcing values on Bottom Axis

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Kitry
Newbie
Newbie
Posts: 16
Joined: Tue May 16, 2006 12:00 am
Location: France

[SOLVED] Forcing values on Bottom Axis

Post by Kitry » Wed May 31, 2006 1:07 pm

I need to see all possibles X 'labels' (eg. '125' , '250', '500', '1000' ...) on the BottomAxis, but it doesn't work if the first Series miss one of this values.

For example :

Code: Select all

     Chart1[0].Clear;
     Chart1[0].AddXY(0,20,'125');
     Chart1[0].AddXY(1,30,'250');
     // No Value for '500'
     Chart1[0].AddXY(3,30,'1000');
     Chart1[0].AddXY(4,50,'2000');

     Chart1[1].Clear;
     Chart1[1].AddXY(0,10,'125');
     // No Value for '250'
     Chart1[1].AddXY(2,100,'500');
     Chart1[1].AddXY(3,200,'1000');
     Chart1[1].AddXY(4,30,'2000');
gives :

Image

How to 'force' the value '500' to appear on the BottomAxis ? Eg, I want to get this :

Image

But :

1) I don't want to swap series, because each series might have a missing values.
2) I don't want to use AddNullXY, as I need continuous lines.

Can someone help ?
Last edited by Kitry on Wed Jul 12, 2006 1:08 pm, edited 1 time in total.

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

Post by Narcís » Wed May 31, 2006 1:17 pm

Hi Kitry,

Then the best option may be using custom labels as shown in the All Features\Welcome !\Axes\Labels\Custom labels example at TeeChart features demo, available at TeeChart's program group.
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

Kitry
Newbie
Newbie
Posts: 16
Joined: Tue May 16, 2006 12:00 am
Location: France

Post by Kitry » Wed May 31, 2006 1:29 pm

Yes, that's perfect !

I was too much focused on the series, and I didn't take care of the Axis properties.

Adding the following code works :

Code: Select all

 with Chart1.Axes.Bottom do
  begin
        Items.Clear;  // remove all custom labels
        Items.Add(0,'125');
        Items.Add(1,'250');
        Items.Add(2,'500');
        Items.Add(3,'1000');
        Items.Add(4,'2000');
 end;
Thank you Narcís :D

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

Post by Narcís » Wed May 31, 2006 1:56 pm

You're welcome Kytry.

I'm happy to hear my suggestion was helpful.
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

Kitry
Newbie
Newbie
Posts: 16
Joined: Tue May 16, 2006 12:00 am
Location: France

Post by Kitry » Wed Jul 12, 2006 9:10 am

In this particular case (see above), I have a problem for Marks Style.

I know that all possible styles are :

smsValue, smsPercent, smsLabel, smsLabelPercent, smsLabelValue, smsLegend, smsPercentTotal, smsLabelPercentTotal, smsXValue, smsXY

but none of them can send me the printed values on the bottom axis.

For exemple :

SmsXValue returns '0' , '1' , '2' ....where I would like to see '125' , '250' , '500'.

I tried all possible styles and none of them could return '125' , '250' , '500'.


Any tips for that ?
TeeChart Pro VCL/CLX V7.07 - Delphi 6 US Entreprise Edition with Update Pack 2 + RTL2 + RTL3 - W2k Pro SP2 French Version

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

Post by Narcís » Wed Jul 12, 2006 9:57 am

Hi Kitry,

It works fine for me here using the code below except for that series marks are not drawn for those points not existing in one of the series (no mark for '500' in Chart1[0] and no mark for '250' in Chart1[1]). If that's not what you are looking for let us know and we will try to find another solution.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1[0].Clear;
  Chart1[0].AddXY(0,20,'125');
  Chart1[0].AddXY(1,30,'250');
  // No Value for '500'
  Chart1[0].AddXY(3,30,'1000');
  Chart1[0].AddXY(4,50,'2000');

  Chart1[0].Marks.Style:=smsLabel;


  Chart1[1].Clear;
  Chart1[1].AddXY(0,10,'125');
  // No Value for '250'
  Chart1[1].AddXY(2,100,'500');
  Chart1[1].AddXY(3,200,'1000');
  Chart1[1].AddXY(4,30,'2000');

  Chart1[1].Marks.Style:=smsLabel;


  with Chart1.Axes.Bottom do
  begin
      Items.Clear;  // remove all custom labels
      Items.Add(0,'125');
      Items.Add(1,'250');
      Items.Add(2,'500');
      Items.Add(3,'1000');
      Items.Add(4,'2000');
  end;
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
Image Image Image Image Image Image
Instructions - How to post in this forum

Kitry
Newbie
Newbie
Posts: 16
Joined: Tue May 16, 2006 12:00 am
Location: France

Post by Kitry » Wed Jul 12, 2006 1:07 pm

My mistake.

It doesn't work because I was doing

Code: Select all

Chart1[0].AddXY(0,20);

with Chart1.Axes.Bottom do 
  begin 
      Items.Clear;  // remove all custom labels 
      Items.Add(0,'125'); 
      Items.Add(1,'250'); 
      Items.Add(2,'500'); 
      Items.Add(3,'1000'); 
      Items.Add(4,'2000'); 
  end; 
 
instead of

Code: Select all

Chart1[0].AddXY(0,20,'125');

with Chart1.Axes.Bottom do 
  begin 
      Items.Clear;  // remove all custom labels 
      Items.Add(0,'125'); 
      Items.Add(1,'250'); 
      Items.Add(2,'500'); 
      Items.Add(3,'1000'); 
      Items.Add(4,'2000'); 
  end; 
 

Sorry about that & Thanks for your help :)
TeeChart Pro VCL/CLX V7.07 - Delphi 6 US Entreprise Edition with Update Pack 2 + RTL2 + RTL3 - W2k Pro SP2 French Version

Post Reply