Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-04

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

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Miguel A. Risco

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.freepascal.org/pipermail/lazarus/attachments/20110418/da11fd4c/attachment.html>

Reply by email

Alexander Klenin
to Miguel A. Risco

2011/4/19 Miguel A. Risco :

Show quoted text 12 lines
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)

I can not reproduce on WindowsXP with Lazarus trunk. I am not sure what problem did you have with the attachment -- it should be very small. I have created an example project for you -- do you see the issue with it?

Alexander S. Klenin -------------- next part -------------- A non-text attachment was scrubbed... Name: userdefseries_zoom_test.7z Type: application/octet-stream Size: 1905 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110419/ae1e982b/attachment-0001.obj>

Reply by email

Miguel A. Risco
to Alexander Klenin

Hi Alexander, your Project is ok, but if your put a tbutton and fill the array on the Onclick event and not in the constructor of the form then the series is not drawing after the zoom on the second point. If I comment the line " if not RectIntersectsRect(ext, ParentChart.CurrentExtent) then exit;" in the TASeries.pas unit then the series is drawing properly.

Best regards

Miguel.

Earlier message 25 lines
-----Mensaje original----- De: Alexander Klenin [mailto:] Enviado el: martes, 19 de abril de 2011 01:14 a.m. Para: Lazarus mailing list Asunto: Re: [Lazarus] TAChart possible Bug: Series with UserDefinedChart Source not are redrawing properly 2011/4/19 Miguel A. Risco : > 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) I can not reproduce on WindowsXP with Lazarus trunk. I am not sure what problem did you have with the attachment -- it should be very small. I have created an example project for you -- do you see the issue with it? -- Alexander S. Klenin

Reply by email

Alexander Klenin
to Miguel A. Risco
Miguel A. Risco wrote
Hi Alexander, your Project is ok, but if your put a tbutton and fill the array on the Onclick event and not in the constructor of the form then the series is not drawing after the zoom on the second point. If I comment the line " if not RectIntersectsRect(ext, ParentChart.CurrentExtent) then exit;" in the TASeries.pas unit then the series is drawing properly.

Ah, I see now.
You need to call ds.Reset before ds.EndUpdate.
Maybe Reset should be called automatically by EndUpdate...

Alexander S. Klenin

Reply by email

Miguel A. Risco
to Alexander Klenin

Calling ds.Reset make the fix. I also think that Reset could be called by EndUpdate.

Thank you

Miguel

Earlier message 22 lines
-----Mensaje original----- De: Alexander Klenin [mailto:] Enviado el: martes, 19 de abril de 2011 02:04 a.m. Para: Lazarus mailing list Asunto: Re: [Lazarus] TAChart possible Bug: Series with UserDefinedChart Source not are redrawing properly On Tue, Apr 19, 2011 at 17:46, Miguel A. Risco wrote: > Hi Alexander, your Project is ok, but if your put a tbutton and fill the array on the Onclick event and not in the constructor of the form then the series is not drawing after the zoom on the second point. If I comment the line " if not RectIntersectsRect(ext, ParentChart.CurrentExtent) then exit;" in the TASeries.pas unit then the series is drawing properly. Ah, I see now. You need to call ds.Reset before ds.EndUpdate. Maybe Reset should be called automatically by EndUpdate... -- Alexander S. Klenin --

Reply by email