Recent

Author Topic: Strange behavior when panning and zooming  (Read 4386 times)

ironphil

  • Jr. Member
  • **
  • Posts: 56
Strange behavior when panning and zooming
« 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?

ironphil

  • Jr. Member
  • **
  • Posts: 56
Re: Strange behavior when panning and zooming
« Reply #1 on: November 12, 2018, 01:10:52 pm »
I forgot to mention that it is with Lazarus 2.0RC2 on windows 10.

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Strange behavior when panning and zooming
« Reply #2 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.

ironphil

  • Jr. Member
  • **
  • Posts: 56
Re: Strange behavior when panning and zooming
« Reply #3 on: November 12, 2018, 02:41:49 pm »
Thank you. Let us know when you'll find a fix.

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Strange behavior when panning and zooming
« Reply #4 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:
  • Open file taseries.pas (in components/tachart)
  • Find the code of TAreaSeries.Draw and, within this, the local procedure DrawSegment
  • This procedure contains two calls to UpdateGraphpoints. Replace the parameter "AStart" by "FLoBound", and "AEnd" by "FUpBound":
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]

ironphil

  • Jr. Member
  • **
  • Posts: 56
Re: Strange behavior when panning and zooming
« Reply #5 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.


 

TinyPortal © 2005-2018