Custom Axes : subdivision of "axes"

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Rodrigue
Newbie
Newbie
Posts: 23
Joined: Fri Jan 28, 2005 5:00 am
Location: Belgium

Custom Axes : subdivision of "axes"

Post by Rodrigue » Mon Feb 07, 2005 2:33 pm

Hi,

I would like to recopy below each custom axes the same subdivision as the bottom axe. Here is a picture :
Image

I do not know how to get the step of subdivision and/or where it begins etc.
As you can see, I've already implemented a code, in the AfterDraw event, who draws the main line.

Thank you for your help!
Cordially,
Rodrigue

Rodrigue
Newbie
Newbie
Posts: 23
Joined: Fri Jan 28, 2005 5:00 am
Location: Belgium

Post by Rodrigue » Mon Feb 07, 2005 2:33 pm

Here is the link of the picture :
http://cjoint.com/?chpHko5gIK

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 Feb 07, 2005 3:30 pm

Hi Rodrigue,

Could you please be more specific? What do you refer when speaking about subdivision?

You can copy one axis from another custom or default axis doing:

Code: Select all

Chart1.CustomAxes[1]:=Chart1.CustomAxes[0];
or

Code: Select all

Chart1.CustomAxes[1]:=Chart1.LeftAxis;
And after having copied it you can change it's specific 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

Rodrigue
Newbie
Newbie
Posts: 23
Joined: Fri Jan 28, 2005 5:00 am
Location: Belgium

Post by Rodrigue » Mon Feb 07, 2005 4:09 pm

Hi,

In fact it is not an axis. It is a drawing! I separate several graphs (here 3) by using opaque zone (as in your examples).
For the moment, I separate these various opaque zones by a line from 2 pixels width.

Code: Select all

void __fastcall TForm1::AfterDrawSeries(TObject *Sender)
{
   ...
   Chart1->Canvas->Pen->Width = 2;
   Chart1->Canvas->Pen->Color = clBlack;

   Chart1->Canvas->Line
   (
      Chart1->ChartRect.Left,
      Series1->GetVertAxis->IEndPos,
      Chart1->ChartRect.Right,
      Series1->GetVertAxis->IEndPos
   );

   Chart1->Canvas->Line
   (
      Chart1->ChartRect.Left,
      Series2->GetVertAxis->IEndPos,
      Chart1->ChartRect.Right,
      Series2->GetVertAxis->IEndPos
   );

I would like that this "line" will be a little more complex.
I would like to make it resemble to the axis bottom (without labels)...
Please, look at my picture.
I've copied exactly what I want on the second axis.

Cordially,
Rodrigue

Rodrigue
Newbie
Newbie
Posts: 23
Joined: Fri Jan 28, 2005 5:00 am
Location: Belgium

Post by Rodrigue » Tue Feb 08, 2005 11:59 am

If you don't understant what I woud like, I can give more details ....

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Feb 09, 2005 7:35 am

Hi.

Yes, that't be great (as I cannot see the image you posted in this thread). Please send more detailed description directly to my address at "marjan at steema dot com". Tnx.
Marjan Slatinek,
http://www.steema.com

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Feb 11, 2005 10:39 am

9340780 wrote:If you don't understant what I woud like, I can give more details ....
Ok, got your email. In your case there is a simple solution. If you want to duplicate one axis (draw it multipe times over chart canvas), then all you must do is use TChartAxis.CustomDraw method to draw axis at specific screen coordinate. Example (code placed in TChart OnBeforeDrawSeries event!):

Code: Select all

var pos: Integer;
begin

  // Draw two axes at 100px and 220px
  pos := 100;
  Chart1.Axes.Bottom.CustomDraw(pos+10,pos+30,pos,False);

  pos := 220;
  Chart1.Axes.Bottom.CustomDraw(pos+10,pos+30,pos,False);
end;

Marjan Slatinek,
http://www.steema.com

Rodrigue
Newbie
Newbie
Posts: 23
Joined: Fri Jan 28, 2005 5:00 am
Location: Belgium

Post by Rodrigue » Fri Feb 11, 2005 11:15 am

Thanks for your reply :D!

Your method works but I don't want the text.
If I set :

Code: Select all

Chart->Axes->Bottom->Labels = false;
The text is not draw but the litte line too :(

I saw on an other post that I can use the event OnGetMarkText.
So I would like to draw Text on the bottom Axe. When I use CustomDraw I don't want to draw Text. How to do that ?

Cordially,
Rodrigue [/url]

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Feb 14, 2005 10:13 am

Hi.

OnGetMarkText is not the best approach. Instead, adding a single line of code might works perfectly:

Code: Select all

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
var oldShowLabels : boolean;
var oldTicksOnLabels : boolean;
begin
  oldShowLabels := Chart1.Axes.Bottom.Labels;
  oldTicksOnLabels := Chart1.Axes.Bottom.TickOnLabelsOnly;

  // custom settings for additiona "copies"
  Chart1.Axes.Bottom.TickOnLabelsOnly := False;
  Chart1.Axes.Bottom.Labels := False;
  Chart1.Axes.Bottom.CustomDraw(100,120,80,False);
  Chart1.Axes.Bottom.CustomDraw(150,170,130,False);

  Chart1.Axes.Bottom.Labels := oldShowLabels;
  Chart1.Axes.Bottom.TickOnLabelsOnly := oldTicksOnLabels;
end;
Marjan Slatinek,
http://www.steema.com

Post Reply