CursorTool

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
JosefG
Newbie
Newbie
Posts: 10
Joined: Tue Nov 25, 2003 5:00 am

CursorTool

Post by JosefG » Tue Jan 18, 2011 2:42 pm

Hi,
is it possible to realize something like an "open curtain" with the cursortool (or anything else).

With two cursortools I select the area of interest the remaining areas of the chart are grayed (but transparent).

Please, see the picture to get my intention.

Moreover, it would be great to be able to move the area of interest with one mousemove.

Regards,
Josef
Attachments
Teechart.jpg
Teechart.jpg (22.64 KiB) Viewed 5621 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: CursorTool

Post by Yeray » Wed Jan 19, 2011 1:17 pm

Hi Josef,

You could use a TColorBandTool and change its StartValue and EndValue at OnMouseMove event.
Here it is a simple example:

Code: Select all

uses Series, TeeTools;

var ColorBand1: TColorBandTool;
    rectWidth: Integer; //pixels

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  with ColorBand1 do
  begin
    StartValue:=Chart1.Axes.Bottom.CalcPosPoint(Round(X-rectWidth/2));
    EndValue:=Chart1.Axes.Bottom.CalcPosPoint(Round(X+rectWidth/2));
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  rectWidth:=50;

  with Chart1.AddSeries(TLineSeries) do FillSampleValues();

  ColorBand1:=Chart1.Tools.Add(TColorBandTool) as TColorBandTool;
  with ColorBand1 do
  begin
    Axis:=Chart1.Axes.Bottom;
  end;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply