Dragging TColorBand

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Dragging TColorBand

Post by Metman » Wed Feb 22, 2012 4:03 pm

Hi

Just a simple question - is it possible to drag a TColorBand?

I realize if the color band has been attached to a horizontal axis then either end of the color band be expanded/contracted. What I would like to do is drag the area horizontally across the chart without changing the extent of the band.

Bruce.

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

Re: Dragging TColorBand

Post by Yeray » Thu Feb 23, 2012 5:33 pm

Hi Bruce,

You can drag the start and end lines as below:

Code: Select all

uses Series, TeeTools;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.AddSeries(TFastLineSeries).FillSampleValues();
  with Chart1.Tools.Add(TColorBandTool) as TColorBandTool do
  begin
    Axis:=Chart1.Axes.Bottom;
    StartValue:=5;
    EndValue:=15;
    ResizeStart:=true;
    ResizeEnd:=true;
  end;
end;
If you want to move both lines at the same time when clicking Down between the two lines and dragging, you could use the OnMouseDown, OnMouseUp and OnMouseMove event to do it manually.
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

Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Re: Dragging TColorBand

Post by Metman » Mon Feb 27, 2012 3:52 pm

Hi Yeray

Thanks for the tip - I did what you suggested and I can now control the bands with the mouse.

Bruce.

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

Re: Dragging TColorBand

Post by Yeray » Tue Feb 28, 2012 4:06 pm

Hi Bruce,

Great! I'm glad to hear it works as you want now. :)
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