I have a Line Series that I want the user to be able to click on and
then I will display some values. The problem is that the line is
very hard to position the mouse over. Customers with unsteady hands
complain it is impossible to place the cursor over the line.
Is there a way to trigger the OnClick routine if the mouse is clicked
within - say 10 pixels?
"tolerace" for clicked line
Hi Tom,
how about using the following code to retrieve and show the values from the series on the Canvas by clicking it ? :
how about using the following code to retrieve and show the values from the series on the Canvas by clicking it ? :
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(10);
Chart1.View3D := False;
end;
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var tmp, tmpL,x1,y1 : Integer;
begin
With Chart1 do
begin
for x1 := 0 to 10 do
for y1 := 0 to 10 do
begin
If (Series1.Clicked(X+x1, Y+y1) <> -1) And (OnSeriesPoint = False) Then
begin
Canvas.Brush.Style := bsSolid;
Canvas.Pen.Color := clBlack;
Canvas.Brush.Color := clWhite;
canvas.TextOut(x+10,y,FormatFloat('#.00',Series1.XScreenToValue(x))+','+FormatFloat('#.00',Series1.YScreenToValue(y)));
OnSeriesPoint := True;
End;
If (Series1.Clicked(X+x1, Y+y1) = -1) And (OnSeriesPoint = True) Then
OnSeriesPoint := False;
end;
End;
end;
procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Chart1.Repaint;
end;
Pep Jorge
http://support.steema.com
http://support.steema.com