2010/6/5 Rick <[email protected]>: > Well of course I don't look at the entire graph at once. I zoom in to maybe > 10 or 20 points at > a time and use a scroll bar the pan the chart. It's a run of data that I > captured from a > logic analyzer. So when I'm zoomed-in, there's an appreciable distance > between data points :)
Ah, I see now -- this completely changes things. > I can take a data set of 100 points and zoom > in so I'm displaying only 10 points and drag a vertical line around just > fine. Expand the data > set to 10k points and look at the same 10-point window, but now the line > lags and the draw > event seems to be much slower. The calls to ACanvas.Line should be the same > in both cases, > shouldn't they? In other words, the time to draw should be unchanged. Of course. I optimized the slowest case -- that is the drawing of the full extent. It did became much faster. Zoomed-in case for large zoom factors stayed about the same, because I thought it is already (relatively) fast. > What was different/what I think > was faster was the mapping between the chart's logical extent and my data set. Yes, for the extremely-zoomed-in case your previous comment about using binary search definitely makes sense. This is yet another long-standing todo item. [I should publish my todo list somewhere... maybe as feature requests on issue tracker?] It is hard to implement properly due to many possible combinations of data sources and axis transformations (consider inverted logarithmic axis case, for example). Still, I think I did it in r25912:25925. This is a complex code, so I please test *and* review it, if you can. The bugs like this one: http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/components/tachart/tacustomseries.pas?root=lazarus&r1=25923&r2=25922&pathrev=25923 are really easy to miss with just one set of eyeballs ;-) To turn on the optimization, you must set Sorted property to true on your chart source. It defaults to false for compatibility -- look at dragdrop demo to see the difference. -- Alexander S. Klenin -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
