Lazarus

Programming => Graphics and Multimedia => TAChart => Topic started by: ironphil on November 12, 2018, 12:57:17 pm

Title: Strange behavior when panning and zooming
Post by: ironphil on November 12, 2018, 12:57:17 pm
Here is a short project reproducing the problem. You can zoom the data with the wheel and pan the chart with the left button.
However, when I pan the chart, the series stay fix, only the X axis is moving. In reality, it is like the series values are changing!
If you can reproduce the problem, is it the project or the chart library that has a problem?
Title: Re: Strange behavior when panning and zooming
Post by: ironphil on November 12, 2018, 01:10:52 pm
I forgot to mention that it is with Lazarus 2.0RC2 on windows 10.
Title: Re: Strange behavior when panning and zooming
Post by: wp on November 12, 2018, 01:23:12 pm
I can reproduce the issue. When I replace the AreaSeries by a LineSeries the bug is gone, i.e. the bug is related to the AreaSeries.
After looking through the svn notes I found the guilty revision: r58562 "TAChart: Back-to-front painting of non-stacked TAreaSeries planes." - I'll have a look.
Title: Re: Strange behavior when panning and zooming
Post by: ironphil on November 12, 2018, 02:41:49 pm
Thank you. Let us know when you'll find a fix.
Title: Re: Strange behavior when panning and zooming
Post by: wp on November 12, 2018, 06:31:22 pm
Fixed in r59528. Please test before I put it onto the merge list for v2.0 (seems to work for me).

If you don't use trunk you can patch the RC2 easily this way:
Code: Pascal  [Select][+][-]
  1. procedure TAreaSeries.Draw(ADrawer: IChartDrawer);
  2. ...
  3.   procedure DrawSegment(AStart, AEnd: Integer);
  4. ...
  5.     // Collect points of top-most curve
  6.     UpdateGraphPoints(Source.YCount-2, FLoBound, FUpBound, FStacked);
  7. ...
  8.         // Stack level points
  9.         UpdateGraphPoints(j - 1, FLoBound, FUpBound, FStacked);[/cpde]
Title: Re: Strange behavior when panning and zooming
Post by: ironphil on November 12, 2018, 06:45:37 pm
Seems good with Lazarus 2.0RC2 and the proposed modifications. The behavior of zoom and drag is now what is expected. I think you can merge it for 2.0. Thanks.
Title: Re: Strange behavior when panning and zooming
Post by: wp on November 12, 2018, 06:50:10 pm
Done: http://wiki.lazarus.freepascal.org/Lazarus_2.0_fixes_branch#Submitted_by_developer_.2F_committer.2C_tested.2C_waiting_to_be_merged
TinyPortal © 2005-2018