Get BottomAxis Value
Posted: Wed Mar 28, 2007 2:09 am
How can I get the BottomAxis Label for a given ColorLine->Value obtained in the ChartTool->DragLine() event?
thanks,
kev
thanks,
kev
Steema Software - Customer Support Forums
http://216.92.101.67/support/
Code: Select all
procedure TForm1.ChartTool1DragLine(Sender: TColorLineTool);
var x, y, index: Integer;
begin
x:=Series1.CalcXPosValue(ChartTool1.Value);
//first way
for y:=Chart1.Axes.Left.IStartPos to Chart1.Axes.Left.IEndPos do
if Series1.Clicked(x,y)<>-1 then index:=Series1.Clicked(x,y);
//second way, more restrictive. Will only show the label when your dragline is placed exactly on a series point.
// index:=Series1.XValues.Locate(ChartTool1.Value);
if index<>-1 then
Chart1.Title.Caption := Series1.Labels[index];
end;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Series1.Clear;
for i:=0 to 10 do
Series1.Add(Random,'label ' + IntToStr(i));
end;