Page 1 of 1

Extending TCursorTool to display over Custom Axes.

Posted: Thu Dec 03, 2009 9:18 pm
by 10548832
I want the vertical line of the TCursorTool to also extend across my custom axes. I want the tool to be assiged to Series1, but to display over other Series on custom axes. I figure I can spend some time coding this but do you folk have a quick method I can use.

Re: Extending TCursorTool to display over Custom Axes.

Posted: Fri Dec 04, 2009 9:12 am
by narcis
Hi Phineas,

The easiest solution I can think of now is using a TColorLineTool for that, for example:

Code: Select all

procedure TForm1.ChartTool1Change(Sender: TCursorTool; x, y: Integer;
  const XValue, YValue: Double; Series: TChartSeries; ValueIndex: Integer);
begin
  ColorLine.Value:=ChartTool1.XValue;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  ColorLine:=TColorLineTool.Create(Self);
  ColorLine.Axis:=Series2.GetHorizAxis;
  ColorLine.Pen.Color:=ChartTool1.Pen.Color;

  ColorLine.Value:=ChartTool1.XValue;
end;
Hope this helps!