[Lazarus] TAChart possible Bug: Series with UserDefinedChart Source not are redrawing properly

Miguel A. Risco mriscoc at gmail.com
Mon Apr 18 19:33:45 CEST 2011


Hi All, I found a possible Bug in TAChart component. Lazarus v0.9.30.1
SVN:3056 on Windows 7 x64

 

Create a Project with a TChart and TButton controls, add a TLineseries and
TUserDefinedChartSource with some points, select the last one as source for
the serie. Define a Var array of real and assign values to the array on the
Tbutton onclick event. Populate the AItem values with the data in the array.
Sometimes when I zoom the chart the serie is not redrawing. (The example
project is not attached because size limit of the message). Make a zoom on
the second point [0.1,0.5] but without include the zero Y axis value, the
serie is not drawing but if the zero level is included in the zoom then the
serie is drawing correctly)

 

  TForm1 = class(TForm)

    Button1: TButton;

    Chart1: TChart;

    Chart1LineSeries1: TLineSeries;

    DataSource: TUserDefinedChartSource;

    procedure Button1Click(Sender: TObject);

    procedure DataSourceGetChartDataItem(ASource: TUserDefinedChartSource;

      AIndex: Integer; var AItem: TChartDataItem);

  end;

 

var

  Form1: TForm1;

  dat:array [0..3] of real;

 

implementation

 

{$R *.lfm}

 

{ TForm1 }

 

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  DataSource.BeginUpdate;

  dat[0]:=0;

  dat[1]:=0.5;

  dat[2]:=0;

  dat[3]:=-0.5;

  DataSource.EndUpdate;

end;

 

procedure TForm1.DataSourceGetChartDataItem(ASource:
TUserDefinedChartSource;

  AIndex: Integer; var AItem: TChartDataItem);

begin

  AItem.X:=AIndex/10;

  AItem.Y:=dat[AIndex];

end;

 

Thank you.

     

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110418/da11fd4c/attachment-0002.html>


More information about the Lazarus mailing list