[kde-edu]: KDE/kdeedu/libkdeedu/kdeeduplot

David Saxton david at bluehaze.org
Wed Oct 18 20:53:34 CEST 2006


KmPlot has some code for automatic positioning of labels (to avoid overwriting 
other labels or existing plots). If this is appropriate for your use, look in 
svn://trunk/KDE/kdeedu/kmplot/kmplot/view.[cpp/h], in 
particular "View::initDrawLabels" and "View::drawLabel".

The algorithm is pretty crude, but fast enough - it just keeps track of where 
stuff has been drawn, and when View::drawLabel is called with a label and a 
position, it just shifts the position about until it finds somewhere close by 
with most of the label area unused. If the label could not be drawn over the 
requested position, then it draws a line from the label to the requested 
position.

David

On Wednesday 18 Oct 2006 08:24, Benoit Jacob wrote:
> Jason: would you agree with me adding some lines of code to prevent labels
> from overlapping one another? I have an idea to do that, using some math
> and the fact that the horizontal spacing between consecutive dots is
> constant.
>
> Benoit
>
> On Tue, 17 Oct 2006, Jason Harris wrote:
> > On 10/17/06, Carsten Niehaus <cniehaus at gmx.de> wrote:
> >> Jason, Pino, what do you think?
> >
> > Great!  We definitely should have a UI-compatible ctor; thanks for adding
> > it. _______________________________________________
> > kde-edu mailing list
> > kde-edu at mail.kde.org
> > https://mail.kde.org/mailman/listinfo/kde-edu
>
> _______________________________________________
> kde-edu mailing list
> kde-edu at mail.kde.org
> https://mail.kde.org/mailman/listinfo/kde-edu


More information about the kde-edu mailing list