请问用TChart显示统计图形,当Series为Fastline时,怎样使屏幕自动向左滚动?

解决方案 »

  1.   

    我想这样
       当Series[i].Xvalues.lastvalue>Series[i].Xvalues.MaxValue时,再使屏幕向左移动
      

  2.   

    With TheChart do
                   begin
                     for t:=0 to SeriesCount-1 do
                     With Series[t] do
                     begin
                       tmpX:=XValues[1]-XValues[0];
                       Delete(0);
                       AddXY( XValues.Last+tmpX,
                              YValues.Last+Random(100)-50,'',clTeeColor);
                     end;
                   end;
      

  3.   

    delphi自带demo里面有这个例子的:里面的scrollfrm(unit:uscroll)
    填写你的sereis的afteradd方法:
    procedure TScrollForm.LineSeries1AfterAdd(Sender: TChartSeries;
      ValueIndex: Longint);
    begin
     { If VERTICAL SCROLL }
      if CBVertical.Checked then
      begin
        With Sender.GetVertAxis do  { <-- with the Vertical Axis... }
        Begin
          Automatic := False;        { <-- we dont want automatic scaling }      { In this example, we will set the Axis Minimum and Maximum values to
            show One Hour of data ending at last point Time plus 5 minutes
          }
          Minimum := 0;
          Maximum := Sender.YValues.MaxValue + DateTimeStep[ dtFiveMinutes ];
          Minimum := Maximum - DateTimeStep[ dtOneHour ];
        end;
      end
      else
      begin
        With Sender.GetHorizAxis do  { <-- with the Horizontal Axis... }
        Begin
          Automatic := False;        { <-- we dont want automatic scaling }      { In this example, we will set the Axis Minimum and Maximum values to
            show One Hour of data ending at last point Time plus 5 minutes
          }
          Minimum := 0;
          Maximum := Sender.XValues.MaxValue + DateTimeStep[ dtFiveMinutes ];
          Minimum := Maximum - DateTimeStep[ dtOneHour ];
        end;
      End;
    end;