Page 1 of 1

Dragging TColorBand

Posted: Wed Feb 22, 2012 4:03 pm
by 10047857
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.

Re: Dragging TColorBand

Posted: Thu Feb 23, 2012 5:33 pm
by yeray
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.

Re: Dragging TColorBand

Posted: Mon Feb 27, 2012 3:52 pm
by 10047857
Hi Yeray

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

Bruce.

Re: Dragging TColorBand

Posted: Tue Feb 28, 2012 4:06 pm
by yeray
Hi Bruce,

Great! I'm glad to hear it works as you want now. :)