Ver Mensaje Individual
  #2  
Antiguo 26-10-2007
rounin rounin is offline
Miembro
 
Registrado: sep 2005
Posts: 43
Reputación: 0
rounin Va por buen camino
Código:
 
procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var xx, yy1, yy2: Double;
    idx: TValuePos;
begin
  {Screen coord -> Plot coord}
  xx := Chart1.BottomAxis.CalcPosPoint(X);
 
  {Binary search and interpolation (units in attachment) }
  yy1 := ValueAt(ArrayAdapter(Series1, 'x'), ArrayAdapter(Series1, 'y'), xx);
  {or}
  if BinSearch(ArrayAdapter(Series2, 'x'), xx, idx)
    then yy2 := ValueAt(ArrayAdapter(Series2, 'y'), idx)
    else yy2 := NaN; // out of range
 
  Caption := Format('%.3f  %.3f  %.3f', [xx, yy1, yy2]);
end;

Última edición por rounin fecha: 06-10-2008 a las 15:05:13.
Responder Con Cita