TAChart: potential improvements in zooming and panning
Original Reporter info from Mantis: Marcin Wiazowski
-
Reporter name:
Original Reporter info from Mantis: Marcin Wiazowski
- Reporter name:
Description:
I created this topic here, to continue a discussion about zooming and panning, that arisen in #34896 (closed).
A test program is attached to this report - by using it and the instructions below, some issues with zooming and panning can be observed; the instruction was written by "wp" and comes from #34896 (closed). The test program has been slightly modified when comparing to the original test program in #34896 (closed), so the instruction below could be shortened a bit.
-----------------
According to documentation, zooming and panning are intended to do nothing else than setting the LogicalExtent
(http://wiki.lazarus.freepascal.org/TAChart_documentation#Extents [^]):
* For zooming the user can paint the new LogicalExtent on the chart by dragging a rectangle from the top/left to bottom/right corners (using the left mouse button). When the mouse is released this rectangle will become the new LogicalExtent.
* For Panning the user drags the viewport to a new location (using the right mouse button).
Panning
=======
* Press the RIGHT mouse button somewhere in the chart and drag it around.
* When marks are off everything behaves as expected, the entire chart nicely follows the mouse, no size changes.
* Click into the chart (with left button) to restore the original position.
* Now turn on the 2nd (huge) mark. Drag the mouse (right button) a bit towards the top --> suddenly the bar becomes much larger (because the guaranteed_space mechanism is turned off). Or drag the mouse down so that the top of the bar disappears below the bottom axis --> suddenly the mark disappears (because the Chart.IsPointInViewPort is no longer true)
* Both effects are not expected by the user and should be avoided.
Zooming
=======
* At first, in order to see the effect of "correct" zooming have both marks turned off and drag the zoom rect closely around the first bar --> when the mouse button is released the bar grows to closely fill the viewport. That's correct.
* Restore the original unzoomed state by clicking with the left button into the chart.
* Turn on the mark of the first bar. Drag a rectangle again closely around the bar without the mark --> the bar increases in size, but the mark is visible. Well - basically I would not expect to see the mark, but with AutoMargins active that's probably how it should be because the chart always tries to show the mark; and since normally the marks are small the zooming effect is clear and appears to be correct.
* But: after resetting the zoom drag a larger rectangle which tightly encloses the bar and the mark --> the bottom part of the mark is expected to be near the x axis, but it turns out to be somewhere in the center of the chart. This is disturbing although this behaviour has been there all the time.
* Reset the zoom again, turn off the the mark of the first bar, and turn on the mark of the second bar, the one with the very high mark. Again drag the zoom rect around the bar only --> the size of the bar does not change because due the size reserved for the margin it can only be drawn in the narrow MinDataSpace. This is not expected.
* Drag a larger zoom rect which encloses the last mark row ('mmmm') and reaches down to the lower end of the bar --> the bar becomes smaller. Again, not expected, some kind of "anti-zooming"...
I did not spend much work on these phenomena, but is seems to me that they are a consequence of the fact that the zoomed region is defined by the LogicalExtent, not by the CurrentExtent.
Mantis conversion info:
- Mantis ID: 35002
- Build: 60312
- Version: 2.1 (SVN)