Page 1 of 1
[ZOOM] Selection rectangle
Posted: Tue Feb 08, 2005 11:04 am
by 9340780
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
Posted: Tue Feb 08, 2005 11:13 am
by narcis
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.
Posted: Tue Feb 08, 2005 4:41 pm
by 9340780
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
Posted: Tue Feb 08, 2005 5:09 pm
by narcis
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);
}
Posted: Tue Feb 08, 2005 6:13 pm
by 9340780
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 :
But it's doesn't solve the problem
...
Very cordially,
Rodrigue
Posted: Wed Feb 09, 2005 3:44 pm
by narcis
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.
Posted: Wed Feb 09, 2005 3:48 pm
by 9340780
Ok, no problem
!