I ran into an inefficiency drawing many data points. It appears that ZedGraph pretty much ignores the clipping region, or rather resets it for it's own purposes when drawing. This isn't a problem unless you very often (>1Hz) add a point. GraphPane.Draw redraws all of the data points, which can be slow if you have 100,000 data points. Drawing all the points is useful, even if far beyond screen resolution, because you can see the range of values, detect anomolies, and zoom in on suspicious areas and see the actual data.
I solved this by only invalidating a small region that just included the added data points. I modified ZedGraph to record the ClipBounds in MasterPane, copy it into the GraphPane, and then SetClip to the intersection of the saved ClipBounds and the Chart rectangle before Drawing the Curve. In Line.cs DrawCurve I use the ClipBoards to modify minX and maxX, and the drawing logic takes care of the rest. I find I can add a data point to a chart with about 100,000 points at 4Hz using about 50% of a CPU.
Attached are the diffs between my patch and 5.1.5.
Please contact me if you have any questions.
Log in to post a comment.