Menu

#131 trend lines extend incorrectly with autoscale on 0.36

open
nobody
None
5
2011-08-15
2011-08-15
Anonymous
No

In version 0.36, trend lines can be extended incorrectly when autoscale is enabled. It happens if both control points are both to left and bottom of chart, then chart is scaled or panned to show the right, such that the autoscaling pushes the control points off the bottom of the chart. When autoscale is not enabled, the control points never move down beyond the bottom of the chart, and the symptom never manifests.

I believe the problem is that TrendLine::draw() uses Scaler::convertToY() to convert to screen co-ordinates, but that function clips at 'height'. So if autoscale is enabled, when the y scaling increases such that the control points would be below the visible area, the control points basically map to the bottom of the visible area, and the trend lines tend towards lying along the bottom of the chart.

I have a local hack which adds a bool parameter 'clip' to the Scaler function, defaulting to true, and then pass false in the invokes from TrendLine. Seems to fix the symptom.

Don't know if it's present in cvs version - doesn't seem to build for me for some reason.

Discussion

MongoDB Logo MongoDB