GNOME Bugzilla – Bug 125419
serie can go beyond the graph boundaries
Last modified: 2004-12-22 21:47:04 UTC
If you zoom in on a serie in a graph (by modifying the min and max values of the axis), the serie go beyond the graph frame. It seems to me that the plotting of serie should restrict to the axis interval.
Created attachment 20912 [details] screenshot of the problem
Known problem. Pie/Ring : not applicable Bar/Col : should work in 1.2.0 Line/Area : todo XY : fixed in my tree
I'm working on clipping for line and area plot. Expect it for tomorrow.
I tried to do the clipping at the view_render level. But it looks ugly and tricky. You'll find attached what I've done for now (compilable but half working). I have the feeling it would be cleaner and as fast if done at the renderer level, using art_svp_intersect. Jody, how did you do for xy plot ?
Created attachment 20953 [details] [review] Half working patch
That is indeed ugly. The code in the renderer looks like it could be simplified a bit, but its probably not worth the effort. I'll tack on an optional clipping mechanism to draw path/polygon.
>The code in the renderer looks like it could be simplified a bit, but You probably mean gog_line_view_render here... >I'll tack on an optional clipping mechanism to draw path/polygon. Not sure to understand who will do the work, you or me ?
Please find attached a preliminary patch that does clipping at the renderer level. If this way of doing things is the right way, I can finish it. The pixbuf renderer must use a temporary pixbuf at the size of the clipping region, plot plugin that use clipping must use temporary pixbuf coordinate system, and svg and gnome-print clipping has to be done.
Created attachment 20978 [details] [review] Preliminary patch
I took a slightly different approach and tried to do logical clipping by adding clipping arguments to draw polygon/path. Your suggestion is interesting and may be a better approach. Why copy the entire region initially then blit back the subset we want ? It seems faster to just dup the subset we want and put all of it back. I'll leave my extensions in place because they may be useful one day, but I prefer your approach for performance reasons.
My patch is now functional, but is not terribly happy with area plots. For elements with positive areas we apparently get the winding number wrong and the clip gets things backwards.
>Why copy the entire region initially then blit back the subset we want >? It seems faster to just dup the subset we want and put all of it >back. Yes, sure. It was a test patch, to see if things work. I'm going to write it properly now.
Here's a more correct patch, implementing clipping for the 3 renderers. I've left logical clipping in place.
Created attachment 21037 [details] [review] Patch
bugzilla is not ideal for patch review. Please email it. 2 suggestions 1) Use push/pop clipregion instead of start/stop 2) Its tempting to move the push/pop up into the ChartView renderer to avoid multiple duplications of the plotting region when there are overlapping plots. It loses for pies/rings, but wins for other cases which seem more common.
patch applied.