Hi Bert,
I modified your example a bit, removing the Timer that only seems to be used to reset the function and the labels when the form is resized.
I've also added OnZoom and UndoZoom events for 2 reasons:
1. I very rarely could reproduce the problem resizing the form. I've been able to do so a pair of times, but never with consistency (and I've ran the project many times). However, I can always reproduce the problem when zooming.
2. The fix works when the source series (BarSeries1 at Chart1) is zoomed and drawn (*) before recalculating the function. So I'm using the events to keep both charts synchronized when zooming and unzooming.
(*) I've also added a checkbox you can activate to force the source series to be redrawn when any chart has been zoomed/unzoomed.
However, since I can't reproduce the problem when resizing the form consistently, I check this part is solved, but since both problems look the same, I'd assume both problems should have been solved with the same modifications.
Bert B. wrote:I copied an older version of TeeDownSampling.pas (dated 30-8-2011) in my project and verified that this file was compiled into the excutable, but that doesn't make any difference. Either downsampling has never been working correct or the change was made much earlier than you wrote.
Try changing this condition at TDownSamplingFunction.AddPoints in TeeDownSampling.pas:
Code: Select all
if (Assigned(ParentChart) and (not IsRectEmpty(ParentChart.ChartRect))) then
For this:
Code: Select all
if Assigned(ParentChart) and IsRectEmpty(ParentChart.ChartRect)
// Avoid Parent Window exception when drawing onto bitmap
and Assigned(ParentChart.Parent) then