Ver Mensaje Individual
  #4  
Antiguo 17-03-2012
rounin rounin is offline
Miembro
 
Registrado: sep 2005
Posts: 43
Reputación: 0
rounin Va por buen camino
Hola,

El hecho es que cuando yo estaba haciendo el utlimo ejemplo, he separado
la clase basica de TSelection y TZoomRect, y declaracion de TEventID se va a ChartObj.pas.
Eso permite sustituir un objeto con otra o usar unas aquellos objetas.
En adjunto hay la ultimas versiones de objetos.

Sobre dos charts sincronizados, necesitas usar
eventos OnZoom, OnUndoZoom, OnScrol:

Código Delphi [-]
function TForm1.AnotherChart(Chart: TChart): TChart;
begin
  if Chart = Chart1
    then Result := Chart2
    else Result := Chart1;
end;
procedure TForm1.ChartZoomChanged(Sender: TObject);
begin
  AnotherChart(Sender as TChart).LeftAxis.Automatic := (Sender as TChart).LeftAxis.Automatic;
  AnotherChart(Sender as TChart).BottomAxis.Automatic := (Sender as TChart).BottomAxis.Automatic;
  AnotherChart(Sender as TChart).LeftAxis.Minimum := (Sender as TChart).LeftAxis.Minimum;
  AnotherChart(Sender as TChart).LeftAxis.Maximum := (Sender as TChart).LeftAxis.Maximum;
  AnotherChart(Sender as TChart).BottomAxis.Minimum := (Sender as TChart).BottomAxis.Minimum;
  AnotherChart(Sender as TChart).BottomAxis.Maximum := (Sender as TChart).BottomAxis.Maximum;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.OnZoom := ChartZoomChanged;
  Chart1.OnUndoZoom := ChartZoomChanged;
  Chart1.OnScroll := ChartZoomChanged;
  Chart2.OnZoom := ChartZoomChanged;
  Chart2.OnUndoZoom := ChartZoomChanged;
  Chart2.OnScroll := ChartZoomChanged;
end;
Archivos Adjuntos
Tipo de Archivo: zip ChartObj.zip (11,8 KB, 14 visitas)
Responder Con Cita