[ZOOM] Selection rectangle

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

[ZOOM] Selection rectangle

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

Hi :) ,

When I make a zoom, I would like to trace a selection rectangle on the canvas of the graph. Here is a picture :
http://cjoint.com/?cimhAKO5v7

TIA !
Cordially,
Rodrigue

Image

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

Post by Narcís » Tue Feb 08, 2005 11:13 am

Hi Rodrigue,

You can do it using the Color Bands tool, you will find some examples of it in the features demo included with the TeeChart installation.
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 » Tue Feb 08, 2005 4:41 pm

Hi,

I've did it but it's very slow !
So I've made this code :

Code: Select all

void __fastcall TForm1::Chart1MouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
   if(Shift.Contains(ssLeft))
   {
      XStartPos = X;
      XStopPos  = X;
   }
}

//---------------------------------------------------------------------------
void __fastcall TForm1::Chart1MouseMove(TObject *Sender, TShiftState Shift,
      int X, int Y)
{
   if(Shift.Contains(ssLeft))
   {
      XStopPos = X;
      Chart1->Invalidate();
   }
}

//---------------------------------------------------------------------------
void __fastcall TForm1::Chart1BeforeDrawAxes(TObject *Sender)
{
      Chart1->Canvas->Rectangle(XStartPos, Chart1->LeftAxis->IStartPos, XStopPos, Chart1->LeftAxis->IEndPos);
}

//---------------------------------------------------------------------------
I've to hide/unhide the rectangle of selection but it works !

It is not as slow as by using the colorband but it is always slow.

I believe that the solution is more simple. My only question is :
Where to specify the color of the background rectangle selection who is draw when we zoom?

http://cjoint.com/?cirRvDHApp
http://cjoint.com/?cirR524NK7

Cordially,
Rodrigue

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

Post by Narcís » Tue Feb 08, 2005 5:09 pm

Hi Rodrigue
Where to specify the color of the background rectangle selection who is draw when we zoom?
You can do it before drawing the rectangle setting Canvas Pen and Brush colors as:

Code: Select all

void __fastcall TForm1::Chart1BeforeDrawAxes(TObject *Sender)
{
        Chart1->Canvas->Pen->Color=clRed;
        Chart1->Canvas->Brush->Color=clBlue;
        Chart1->Canvas->Rectangle(XStartPos, Chart1->LeftAxis->IStartPos,
                                         XStopPos, Chart1->LeftAxis->IEndPos);
}
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 » Tue Feb 08, 2005 6:13 pm

Hi,

Thanks for your reply. I found easier :

Code: Select all

Chart1->Zoom->Brush->Color = clBlue;
(idem for color's Pen)

I've a problem of blink now !
I try to set :

Code: Select all

Chart1->DoubleBuffered = true;
But it's doesn't solve the problem :? ...

Very cordially,
Rodrigue

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 Feb 09, 2005 3:44 pm

Hi Rodrigue,
I've a problem of blink now !
I'm afraid there's no solution by now. I've included it on our wish list to be considered for future releases.
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 » Wed Feb 09, 2005 3:48 pm

Ok, no problem :o!

Post Reply