How can I get the BottomAxis Label for a given ColorLine->Value obtained in the ChartTool->DragLine() event?
thanks,
kev
Get BottomAxis Value
Hello Kev,
the following example shows you two ways to achieve it:
the following example shows you two ways to achieve it:
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;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |